コード例 #1
0
ファイル: dr1010.py プロジェクト: paulmalherbe/Tartan
    def doImport(self):
        self.df.setWidget(self.df.B3, state="disabled")
        self.df.setWidget(self.df.mstFrame, state="hide")
        fi = FileImport(self.opts["mf"], imptab="drsmst", impskp=["drm_cono"])
        sp = ProgressBar(self.opts["mf"].body,
                         typ="Importing Debtor's Accounts",
                         mxs=len(fi.impdat))
        err = None
        for num, line in enumerate(fi.impdat):
            sp.displayProgress(num)
            if not line[1]:
                if not line[2]:
                    err = "Blank Account Number and Blank Name"
                    break
                for x in range(1, 100):
                    line[1] = genAccNum(line[2], x, 7)
                    chk = self.sql.getRec("drsmst",
                                          where=[("drm_cono", "=",
                                                  self.opts["conum"]),
                                                 ("drm_chain", "=", line[0]),
                                                 ("drm_acno", "=", line[1])],
                                          limit=1)
                    if not chk:
                        break
            chk = self.sql.getRec("drsmst",
                                  where=[("drm_cono", "=", self.opts["conum"]),
                                         ("drm_chain", "=", line[0]),
                                         ("drm_acno", "=", line[1])],
                                  limit=1)
            if chk:
                err = "%s %s %s %s Already Exists" % (fi.impcol[0][0], line[0],
                                                      fi.impcol[1][0], line[1])
                break
            if not line[2]:
                err = "Blank Name"
                break
            if not line[15]:
                line[15] = self.sysdtw
            if not line[28]:
                line[28] = "N"
            if not line[31]:
                line[31] = "N"
            line.insert(0, self.opts["conum"])
            self.sql.insRec("drsmst", data=line)
        sp.closeProgress()
        if err:
            err = "Line %s: %s" % ((num + 1), err)
            showError(
                self.opts["mf"].body, "Import Error", """%s

Please Correct your Import File and then Try Again.""" % err)
            self.opts["mf"].dbm.rollbackDbase()
        else:
            self.opts["mf"].dbm.commitDbase()
        self.df.setWidget(self.df.mstFrame, state="show")
        self.df.focusField(self.df.frt, self.df.pag, self.df.col)
コード例 #2
0
ファイル: cr1010.py プロジェクト: paulmalherbe/Tartan
 def doName(self, frt, pag, r, c, p, i, w):
     self.name = w
     if self.new and not self.acno:
         for x in range(1, 100):
             self.acno = genAccNum(self.name, x, 7)
             chk = self.sql.getRec("crsmst",
                                   where=[("crm_cono", "=",
                                           self.opts["conum"]),
                                          ("crm_acno", "=", self.acno)],
                                   limit=1)
             if not chk:
                 break
         self.df.loadEntry("T", 0, 0, data=self.acno)
コード例 #3
0
ファイル: ln1010.py プロジェクト: paulmalherbe/Tartan
 def doName(self, frt, pag, r, c, p, i, w):
     if self.newacc:
         chk = self.sql.getRec("lonmf1",
                               where=[("lm1_cono", "=", self.opts["conum"]),
                                      ("lm1_name", "=", w)],
                               limit=1)
         if chk:
             return "An Account With This Name Already Exists"
         for seq in range(1, 100):
             self.acno = genAccNum(w, seq)
             chk = self.sql.getRec("lonmf1",
                                   where=[("lm1_cono", "=",
                                           self.opts["conum"]),
                                          ("lm1_acno", "=", self.acno)],
                                   limit=1)
             if not chk:
                 break
         self.df.loadEntry(frt, pag, p - 1, data=self.acno)
コード例 #4
0
ファイル: ln6010.py プロジェクト: paulmalherbe/Tartan
 def doGenerate(self):
     self.opts["mf"].updateStatus("")
     ok = askQuestion(self.opts["mf"].body, "ARE YOU SURE???",
         "Are You Certain This Is What You Want To Do? This "\
         "Will Automatically Generate New Account Numbers For "\
         "All Accounts Based On The Account Names!", default="no")
     if ok == "no":
         self.df.focusField("T", 0, 1)
         return
     self.df.closeProcess()
     self.autogen = "Y"
     recs = self.sql.getRec("lonmf1",
                            where=[("lm1_cono", "=", self.opts["conum"])],
                            order="lm1_name")
     col = self.sql.lonmf1_col
     if recs:
         p = ProgressBar(self.opts["mf"].body,
                         typ="Generating Account Numbers",
                         mxs=len(recs))
         for num, acc in enumerate(recs):
             p.displayProgress(num)
             self.oldacc = acc[col.index("lm1_acno")]
             name = acc[col.index("lm1_name")]
             for seq in range(1, 100):
                 self.newacc = genAccNum(name, seq)
                 if self.newacc == self.oldacc:
                     break
                 chk = self.sql.getRec("lonmf1",
                                       where=[("lm1_cono", "=",
                                               self.opts["conum"]),
                                              ("lm1_acno", "=", self.newacc)
                                              ],
                                       limit=1)
                 if not chk:
                     break
             self.doProcess(focus=False)
         p.closeProgress()
     self.opts["mf"].dbm.commitDbase(ask=True)
     self.opts["mf"].closeLoop()