Beispiel #1
0
 def doEnd(self):
     self.df.closeProcess()
     if not self.rep:
         self.srep = ""
         self.erep = "zzz"
     else:
         self.srep = self.rep
         self.erep = self.rep
     col = [
         "stt_rep", "stt_group", "stt_code", "stt_loc", "stt_type",
         "stt_ref1", "stt_ref2", "stt_trdt", "stt_desc", "stt_acno",
         "stt_qty", "stt_cost", "stt_sell", "st1_desc"
     ]
     whr = [("stt_cono", "=", self.opts["conum"]), ("stt_cono=st1_cono", ),
            ("stt_group=st1_group", ), ("stt_code=st1_code", ),
            ("stt_curdt", ">=", self.sdate),
            ("stt_curdt", "<=", self.edate), ("stt_rep", ">=", self.srep),
            ("stt_rep", "<=", self.erep), ("stt_type", "in", (7, 8))]
     odr = "stt_rep, stt_type, stt_batch, stt_ref1"
     recs = self.sql.getRec(tables=["strmf1", "strtrn"],
                            cols=col,
                            where=whr,
                            order=odr)
     if not recs:
         showError(self.opts["mf"].body, "Processing Error",
                   "No Records Selected")
     else:
         self.printReport(recs)
     if "args" in self.opts and "noprint" in self.opts["args"]:
         self.t_work = [self.df.t_work[0][0]]
     self.closeProcess()
Beispiel #2
0
 def doStart(self, frt, pag, r, c, p, i, w):
     if self.doCheckTrn(w):
         showError(self.opts["mf"].body, "Date Error",
             "Transactions Exist On or After This Starting Date.")
         return "Invalid Date"
     self.start = w
     self.oldr = self.sql.getRec("ctlvrf", where=[("vtr_cono",
         "=", self.opts["conum"]), ("vtr_code", "=", self.code),
         ("vtr_date", "=", self.start)], limit=1)
     if not self.oldr:
         self.newr = True
         if self.cat in ("N", "X", "Z"):
             if self.edit:
                 self.ed.loadEntry(frt, pag, p+1, data=0)
             else:
                 self.df.loadEntry(frt, pag, p+1, data=0)
             return "nd"
     else:
         self.newr = False
         if self.edit:
             self.ed.loadEntry(frt, pag, p+1,
                 data=self.oldr[self.sql.ctlvrf_col.index("vtr_rate")])
         else:
             self.df.loadEntry(frt, pag, p+1,
                 data=self.oldr[self.sql.ctlvrf_col.index("vtr_rate")])
Beispiel #3
0
 def doEnd(self):
     self.df.closeProcess()
     if not self.group:
         self.sgrp = ""
         self.egrp = "zzz"
     else:
         self.sgrp = self.group
         self.egrp = self.group
     whr = [("st1_cono", "=", self.opts["conum"]),
            ("st1_group", ">=", self.sgrp), ("st1_group", "<=", self.egrp)]
     if self.redt == "Y":
         whr.append(("st1_type", "not", "in", ("R", "X")))
     else:
         whr.append(("st1_type", "<>", "R"))
     recs = self.sql.getRec(
         "strmf1",
         cols=["st1_group", "st1_code", "st1_desc", "st1_uoi"],
         where=whr,
         order="st1_group, st1_code")
     if not recs:
         showError(self.opts["mf"].body, "Processing Error",
                   "No Records Selected")
     elif self.df.repprt[2] == "export":
         self.exportReport(recs)
     else:
         self.printReport(recs)
     if "args" in self.opts and "noprint" in self.opts["args"]:
         self.t_work = [self.df.t_work[0][0]]
     self.closeProcess()
Beispiel #4
0
 def doEnd(self):
     self.df.closeProcess()
     if not self.group:
         self.sgrp = ""
         self.egrp = "zzz"
     else:
         self.sgrp = self.group
         self.egrp = self.group
     whr = [
         ("st1_cono", "=", self.opts["conum"]),
         ("st1_group", ">=", self.sgrp),
         ("st1_group", "<=", self.egrp),
         ("st1_type", "=", "R")]
     odr = "st1_group, st1_code"
     if self.whole == "S":
         recs = getSingleRecords(self.opts["mf"], "strmf1",
             ("st1_group", "st1_code", "st1_desc"), where=whr, order=odr)
     else:
         recs = self.sql.getRec("strmf1", where=whr, order=odr)
     if not recs:
         showError(self.opts["mf"].body, "Processing Error",
             "No Records Selected")
     else:
         self.printReport(recs)
     self.closeProcess()
Beispiel #5
0
 def doEnd(self):
     self.df.closeProcess()
     if not self.btype:
         styp = 0
         etyp = 99
     else:
         styp = etyp = self.btype
     if not self.batch:
         sbat = ""
         ebat = "zzzzzzz"
     else:
         sbat = ebat = self.batch
     recs = self.sql.getRec("asstrn",
                            where=[("ast_cono", "=", self.opts["conum"]),
                                   ("ast_curdt", "between", self.sdat.work,
                                    self.edat.work),
                                   ("ast_batch", "between", sbat, ebat),
                                   ("ast_type", "between", styp, etyp)],
                            order="ast_type, ast_batch, ast_refno")
     if not recs:
         showError(self.opts["mf"].body, "Processing Error",
                   "No Asset Transactions Selected")
     else:
         self.printReport(recs)
     self.closeProcess()
Beispiel #6
0
 def doEnd(self):
     self.df.closeProcess()
     tab = ["memmst"]
     whr = [("mlm_cono", "=", self.opts["conum"]),
            ("mlm_memno", ">=", self.acc1), ("mlm_memno", "<=", self.acc2),
            ("mlm_state", "=", "A")]
     if self.cat:
         tab.append("memcat")
         whr.append(("mlc_cono=mlm_cono", ))
         whr.append(("mlc_memno=mlm_memno", ))
         whr.append(("mlc_type", "=", self.cat))
         if self.cod:
             whr.append(("mlc_code", "=", self.cod))
     odr = "mlm_memno"
     mems = self.sql.getRec(tables=tab,
                            cols=[
                                "mlm_memno", "mlm_title", "mlm_initial",
                                "mlm_surname", "mlm_names", "mlm_nation",
                                "mlm_dob"
                            ],
                            where=whr,
                            order=odr)
     if not mems:
         showError(self.opts["mf"].body, "Selection Error",
                   "No Members Selected")
     self.printReport(mems)
     self.closeProcess()
Beispiel #7
0
 def doEnd(self):
     self.df.closeProcess()
     self.emadd = self.df.repeml[2]
     if self.whole == "N":
         recs = getSingleRecords(self.opts["mf"],
                                 "rtlmst",
                                 ("rtm_code", "rtm_acno", "rtm_name"),
                                 where=[("rtm_cono", "=",
                                         self.opts["conum"])])
     else:
         whr = [("rtm_cono", "=", self.opts["conum"])]
         odr = "rtm_code, rtm_acno"
         recs = self.sql.getRec("rtlmst", where=whr, order=odr)
         if not recs:
             showError(self.opts["mf"].body, "Error",
                       "No Accounts Selected")
     if recs:
         self.form = DrawForm(self.opts["mf"].dbm,
                              self.tname,
                              wrkdir=self.opts["mf"].rcdic["wrkdir"])
         self.doLoadStatic()
         self.form.doNewDetail()
         p = ProgressBar(self.opts["mf"].body, mxs=len(recs), esc=True)
         for num, rec in enumerate(recs):
             p.displayProgress(num)
             if p.quit:
                 break
             self.doProcess(rec)
         p.closeProgress()
         if p.quit or not self.form.page:
             pass
         elif self.df.repeml[1] == "N" or not self.emadd:
             self.df.repeml[2] = self.emadd
             self.doPrint()
     self.opts["mf"].closeLoop()
Beispiel #8
0
 def doExit(self):
     if self.df.frt == "C":
         self.df.focusField("C", 0, self.df.col)
         return
     if not self.fmat or not self.date:
         self.df.closeProcess()
         self.opts["mf"].closeLoop()
         return
     plrs = {}
     acc = self.sql.getRec(
         "bwlflt",
         cols=["bft_player", "bft_team", "bft_skip", "bft_position"],
         where=[("bft_cono", "=", self.opts["conum"]),
                ("bft_fmat", "=", self.fmat), ("bft_type", "=", self.ftyp),
                ("bft_date", "=", self.date)],
         order="bft_player")
     for a in acc:
         if a[0] in plrs:
             showError(
                 self.opts["mf"].body, "Duplicate",
                 "Player Code %s is in Team Codes %s and %s" %
                 (a[0], plrs[a[0]][0], a[1]))
             self.df.focusField("T", 0, 6)
             return
         else:
             plrs[a[0]] = [a[1], a[2], a[3]]
     self.df.closeProcess()
     if not self.reprint:
         self.opts["mf"].dbm.commitDbase()
     ok = askQuestion(self.opts["mf"].body, "Print",
                      "Do You Want to View/Print the Selections")
     if ok == "yes":
         self.doPrintSelection()
     self.opts["mf"].closeLoop()
Beispiel #9
0
 def doEnd(self):
     self.df.closeProcess()
     if self.slsctl and self.totsonly == "N":
         self.doCancel()
     jon = "left outer join drsmst on drt_cono=drm_cono and "\
         "drt_chain=drm_chain and drt_acno=drm_acno"
     col = [
         "drt_chain", "drt_acno", "drt_trdt", "drt_type", "drt_ref1",
         "drt_batch", "drt_tramt", "drt_taxamt", "drt_desc", "drt_taxind",
         "drm_name"
     ]
     odr = "drt_type, drt_batch, drt_trdt, drt_ref1"
     recs = self.sql.getRec("drstrn",
                            join=jon,
                            cols=col,
                            where=self.whr,
                            order=odr)
     if not recs:
         showError(self.opts["mf"].body, "Transaction Error",
                   "No Transactions Selected")
     elif self.df.repprt[2] == "export":
         self.exportReport(recs)
     else:
         self.printReport(recs)
     if "args" in self.opts and "noprint" in self.opts["args"]:
         self.t_work = [self.df.t_work[0][0]]
     self.closeProcess()
Beispiel #10
0
 def doEnd(self):
     self.df.closeProcess()
     if not self.btype:
         self.styp = 0
         self.etyp = 99
     else:
         self.styp = self.etyp = self.btype
     if not self.batch:
         self.sbat = ""
         self.ebat = "zzzzzzz"
     else:
         self.sbat = self.ebat = self.batch
     whr = [("lnt_cono", "=", self.opts["conum"]), ("lnt_curdt", "between",
         self.sdatw, self.edatw), ("lnt_batch", "between", self.sbat,
         self.ebat), ("lnt_type", "between", self.styp, self.etyp)]
     odr = "lnt_type, lnt_batch, lnt_trdt, lnt_refno"
     recs = self.sql.getRec("lontrn", where=whr, order=odr)
     if not recs:
         showError(self.opts["mf"].body, "Transaction Error",
         "No Transactions Selected")
     elif self.df.repprt[2] == "export":
         self.exportReport(recs)
     else:
         self.printReport(recs)
     self.closeProcess()
Beispiel #11
0
 def doEnd(self):
     self.df.closeProcess()
     col = [
         "wt2_type", "wt2_code", "ced_desc", "wt2_empno", "wgm_sname",
         "wgm_fname", "round(sum(wt2_eamt),2)", "round(sum(wt2_ramt),2)"
     ]
     whr = [("wt2_cono", "=", self.opts["conum"])]
     if self.sdatew == self.edatew:
         whr.append(("wt2_date", "=", self.edatew))
     else:
         whr.append(("wt2_date", "between", self.sdatew, self.edatew))
     if self.rtyp != "B":
         whr.append(("wt2_type", "=", self.rtyp))
     whr.extend([("wgm_cono=wt2_cono", ), ("ced_cono=wt2_cono", ),
                 ("ced_type=wt2_type", ), ("ced_code=wt2_code", ),
                 ("wgm_empno=wt2_empno", )])
     grp = "wt2_type, wt2_code, ced_desc, wt2_empno, wgm_sname, wgm_fname"
     if self.sdatew == self.edatew:
         grp = "%s, wt2_date" % grp
     odr = "wt2_type desc, wt2_code asc, wt2_empno"
     recs = self.sql.getRec(tables=["wagmst", "wagedc", "wagtf2"],
                            cols=col,
                            where=whr,
                            group=grp,
                            order=odr)
     if not recs:
         showError(self.opts["mf"].body, "Selection Error",
                   "No Transactions for the Period")
     else:
         self.doPrintReport(recs)
     self.closeProcess()
Beispiel #12
0
 def doEnd(self):
     recs = self.sql.getRec("drsdel", order="del_code")
     if not recs:
         showError(self.opts["mf"].body, "Error", "No Available Records")
         self.closeProcess()
     else:
         self.printReport(recs)
Beispiel #13
0
 def doEnd(self):
     self.df.closeProcess()
     vtm = [("vtm_cono", "=", self.opts["conum"])]
     if self.cat == "B":
         vtm.append(("vtm_cat", "<>", "N"))
     elif self.cat != "A":
         vtm.append(("vtm_cat", "=", self.cat))
     if self.code:
         vtm.append(("vtm_code", "=", self.code))
     odr = "vtm_cat, vtm_code"
     recs = self.sql.getRec("ctlvmf", where=vtm, order=odr)
     if not recs:
         showError(self.opts["mf"].body, "Selection Error",
                   "No Records Selected")
     else:
         if self.df.repprt[2] == "export":
             self.exportReport(recs)
         else:
             self.printReport(recs)
         if self.flag == "Y":
             self.sql.updRec("ctlvtf",
                             cols=["vtt_paid"],
                             data=[self.paid],
                             where=[("vtt_cono", "=", self.opts["conum"]),
                                    ("vtt_curdt", "<=", self.eper),
                                    ("vtt_paid", "=", 0)])
             self.opts["mf"].dbm.commitDbase()
     self.closeProcess()
Beispiel #14
0
 def processRecords(self):
     if "args" in self.opts:
         self.repprt = ["N", "V", "view"]
         self.repeml = None
     else:
         self.repprt = self.df.repprt
         self.repeml = self.df.repeml
     jon = "left outer join memmst on mlt_cono=mlm_cono and "\
         "mlt_memno=mlm_memno"
     col = [
         "mlt_memno", "mlt_trdt", "mlt_type", "mlt_refno", "mlt_batch",
         "mlt_tramt", "mlt_taxamt", "mlt_desc", "mlt_taxind", "mlm_surname",
         "mlm_names"
     ]
     odr = "mlt_type, mlt_batch, mlt_trdt, mlt_refno"
     recs = self.sql.getRec("memtrn",
                            join=jon,
                            cols=col,
                            where=self.whr,
                            order=odr)
     if not recs:
         showError(self.opts["mf"].body, "Transaction Error",
                   "No Transactions Selected")
     elif self.repprt[2] == "export":
         self.exportReport(recs)
     else:
         self.printReport(recs)
Beispiel #15
0
    def doImport(self):
        self.df.setWidget(self.df.mstFrame, state="hide")
        fi = FileImport(self.opts["mf"], imptab="scpclb", impskp=[])
        sp = ProgressBar(self.opts["mf"].body,
                         typ="Importing Club Records",
                         mxs=len(fi.impdat))
        err = None
        for num, line in enumerate(fi.impdat):
            sp.displayProgress(num)
            chk = self.sql.getRec("scpclb",
                                  where=[("scc_club", "=", line[0])],
                                  limit=1)
            if chk:
                err = "%s %s Already Exists" % (fi.impcol[0][0], line[0])
                break
            if not line[1]:
                err = "Blank Name"
                break
            self.sql.insRec("scpclb", 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)
Beispiel #16
0
 def doEnd(self):
     self.df.closeProcess()
     tab = ["memmst"]
     whr = [("mlm_cono", "=", self.opts["conum"]),
            ("mlm_memno", ">=", self.acc1), ("mlm_memno", "<=", self.acc2)]
     if self.stat == "A":
         whr.append(("mlm_state", "=", "A"))
     elif self.stat == "N":
         whr.append(("mlm_state", "<>", "A"))
     if self.cat:
         tab.append("memcat")
         whr.append(("mlc_cono=mlm_cono", ))
         whr.append(("mlc_memno=mlm_memno", ))
         whr.append(("mlc_type", "=", self.cat))
         if self.cod:
             whr.append(("mlc_code", "=", self.cod))
     if self.totsonly == "N" and self.sort == "N":
         odr = "mlm_memno"
     else:
         odr = "mlm_surname"
     recs = self.sql.getRec(
         tables=tab,
         cols=["mlm_memno", "mlm_title", "mlm_initial", "mlm_surname"],
         where=whr,
         order=odr)
     if not recs:
         showError(self.opts["mf"].body, "Selection Error",
                   "No Members Selected")
     elif self.df.repprt[2] == "export":
         self.exportReport(recs)
     else:
         self.printReport(recs)
     self.closeProcess()
Beispiel #17
0
 def doWriteHeader(self):
     # Header Record
     if self.reprint == "N" or not self.lastreg:
         self.lastreg += 1
     self.irp5nm = os.path.join(
         self.opts["mf"].rcdic["wrkdir"],
         "irp5fl_%03i_%04i.txt" % (self.opts["conum"], self.taxyr))
     self.irp5fl = open(self.irp5nm, "w")
     # Employer Details
     try:
         recon = int("%4i%02i" % (self.taxyr, self.taxmth))
         self.irp5fl.write('2010,"%s",2015,"%4s",2020,%010i,2022,"%-10s",'\
             '2024,"%-10s",2025,"%s",2026,"%s",2027,"%s",2028,"tartan",'\
             '2030,%04i,2031,%06i,2035,%04i,2064,"%s",2065,"%s",2066,"%s",'\
             '2080,%04i,9999\n' % (self.opts["conam"].strip(), self.rtype,
             self.regno, self.sdlno, self.uifno, self.cname.strip(),
             self.cotel[:11].strip(), self.coeml, self.taxyr, recon,
             self.trade, self.coad1[:24].strip(), self.coad2.strip(),
             self.coad3[:21].strip(), self.cocod))
         self.totrecs += 1
         for code in (2010, 2015, 2020, 2022, 2024, 2025, 2026, 2027, 2028,
                      2030, 2031, 2035, 2064, 2065, 2066, 2080, 9999):
             self.totcode += code
     except Exception as err:
         showError(None, "Header Record Error", "There is a Problem "\
             "with your Company or Control Records, Please Fix the "\
             "Problem and then Reprint\n\n%s" % err)
         self.error = True
Beispiel #18
0
 def doEnd(self):
     self.df.closeProcess()
     whr = [("rep_cono", "=", self.opts["conum"])]
     if self.rep1:
         whr.append(("rep_code", ">=", self.rep1))
     if self.rep2:
         whr.append(("rep_code", "<=", self.rep2))
     recs = self.sql.getRec("ctlrep", cols=["rep_code", "rep_name"],
         where=whr, order="rep_code")
     if not recs:
         showError(self.opts["mf"].body, "Processing Error",
         "No Records Selected")
     else:
         self.mthhead = ""
         space = " " * 11
         y = self.end % 100
         for _ in range(0, 12):
             y = y + 1
             if y == 13:
                 y = 1
             self.mthhead = self.mthhead + \
                 space[:(11 - len(mthnam[y][1]))] + mthnam[y][1]
         self.printReport(recs)
     if "args" in self.opts and "noprint" in self.opts["args"]:
         self.t_work = [self.df.t_work[0][0]]
     self.closeProcess()
Beispiel #19
0
 def setVariables(self):
     self.sql = Sql(self.opts["mf"].dbm, [
         "ctlmst", "memctk", "memmst", "memadd", "memkon", "memctc",
         "memctk"
     ],
                    prog=self.__class__.__name__)
     if self.sql.error:
         return
     gc = GetCtl(self.opts["mf"])
     ctlsys = gc.getCtl("ctlsys")
     if not ctlsys:
         return
     self.smtp = []
     for fld in ("msvr", "mprt", "msec", "maut", "mnam", "mpwd"):
         self.smtp.append(ctlsys["sys_%s" % fld])
     if not self.smtp[0]:
         showError(self.opts["mf"].body, "SMTP Error",
                   "There is NO SMTP Server in the System Record!")
         return
     ctlmst = gc.getCtl("ctlmst", self.opts["conum"])
     if not ctlmst:
         return
     self.fadd = ctlmst["ctm_email"]
     if not self.fadd:
         showError(self.opts["mf"].body, "From Error",
                   "There is NO Email Address on the Company Record!")
         return
     memctl = gc.getCtl("memctl", self.opts["conum"])
     if not memctl:
         return
     return True
Beispiel #20
0
 def doEnd(self):
     self.df.closeProcess()
     whr = [("st2_cono", "=", self.opts["conum"])]
     if self.group:
         whr.append(("st2_group", "=", self.group))
     whr.append(("st1_type", "=", "N"))
     whr.append(("st2_loc", "=", self.loc))
     whr.extend([("st1_cono=st2_cono", ), ("st1_group=st2_group", ),
                 ("st1_code=st2_code", )])
     odr = "st2_loc, st2_group, st2_code"
     recs = self.sql.getRec(tables=["strmf1", "strmf2"],
                            cols=[
                                "st2_group", "st2_code", "st1_desc",
                                "st1_uoi", "st1_vatcode"
                            ],
                            where=whr,
                            order=odr)
     if not recs:
         showError(self.opts["mf"].body, "Processing Error",
                   "No Records Selected")
     elif self.df.repprt[2] == "export":
         self.exportReport(recs)
     elif self.rtype == "S":
         self.printSell(recs)
     else:
         self.printCost(recs)
     self.closeProcess()
Beispiel #21
0
 def doEnd(self):
     self.df.closeProcess()
     odr = "rtc_code, rtc_acno, rtc_cnum"
     whr = [("rtc_cono", "=", self.opts["conum"]),
            ("rtc_start", "<=", self.date)]
     if self.styp in ("C", "X"):
         whr.append(("rtc_status", "=", self.styp))
     if self.cons == "Y":
         recs = []
         cols = ["rtc_code", "rtc_acno", "max(rtc_cnum)"]
         accs = self.sql.getRec("rtlcon",
                                cols=cols,
                                where=whr,
                                group="rtc_code, rtc_acno",
                                order="rtc_code, rtc_acno")
         for acc in accs:
             w = copyList(whr)
             w.append(("rtc_code", "=", acc[0]))
             w.append(("rtc_acno", "=", acc[1]))
             w.append(("rtc_cnum", "=", acc[2]))
             rec = self.sql.getRec("rtlcon", where=w, limit=1)
             recs.append(rec)
     else:
         recs = self.sql.getRec("rtlcon", where=whr, order=odr)
     if not recs:
         showError(self.opts["mf"].body, "Selection Error",
                   "No Records Selected")
     else:
         self.printReport(recs)
     self.closeProcess()
Beispiel #22
0
 def doEnd(self):
     if self.df.pag == 1:
         self.df.selPage("Accounts")
         for x in range(4):
             wid = getattr(self.df, "B%s" % x)
             self.df.setWidget(wid, state="normal")
         self.opts["mf"].updateStatus("Click the Required Option Button")
         self.df.setWidget(self.df.topEntry[2][0], state="disabled")
         return
     if self.opt == "A":
         cmd = ["usermod -p %s %s" % (self.usrpwd, self.usrnam)]
     elif self.opt == "D":
         ask = askQuestion(self.opts["mf"].body, "Remove Directory",
             "Must the User's Home Directory Also be Deleted", default="no")
         if ask == "yes":
             cmd = ["userdel -r %s" % self.usrnam]
         else:
             cmd = ["userdel %s" % self.usrnam]
     elif self.opt == "N":
         cmd = [
             "useradd -g users -m %s -p %s" % (self.usrnam, self.usrpwd)]
         if self.usrtyp == "M":
             cmd.extend([
                 "cp -r /etc/skel/Maildir /home/%s/" % self.usrnam,
                 "maildirmake /home/%s/.maildir" % self.usrnam,
                 "chown -R %s:users /home/%s" % (self.usrnam, self.usrnam),
                 "chmod -R 700 /home/%s/Maildir" % self.usrnam])
     err = self.executeCommand(cmd)
     if err:
         showError(self.opts["mf"].body, "SSH Error", err)
     self.doExit()
Beispiel #23
0
 def printReport(self, recs):
     p = ProgressBar(self.opts["mf"].body, mxs=len(recs), esc=True)
     self.head = "%03u %-77s" % (self.opts["conum"], self.opts["conam"])
     self.fpdf = MyFpdf(name=self.__class__.__name__, head=self.head)
     self.btot = [0, 0]
     self.pglin = 999
     bc = self.sql.ctlbat_col
     tc = self.sql.wagltf_col
     for num, dat in enumerate(recs):
         p.displayProgress(num)
         if p.quit:
             break
         self.rtyp = CCD(dat[bc.index("btm_rtyp")], "UI", 1)
         self.batno = CCD(dat[bc.index("btm_batno")], "Na", 7)
         self.curdt = CCD(dat[bc.index("btm_curdt")], "D2", 7)
         self.multi = CCD(dat[bc.index("btm_multi")], "UA", 1)
         self.trno = CCD(dat[bc.index("btm_trno")], "UI", 7)
         self.trval = CCD(dat[bc.index("btm_trval")], "SD", 13.2)
         whr = [
             ("wlt_cono", "=", self.opts["conum"]),
             ("wlt_type", "=", self.rtyp.work),
             ("wlt_batch", "=", self.batno.work),
             ("wlt_batind", "=", "N")]
         odr = "wlt_seq"
         trndat = self.sql.getRec("wagltf", where=whr, order=odr)
         if not trndat:
             continue
         if self.pglin > self.fpdf.lpp:
             self.pageHeading()
         else:
             self.batchHeading()
         for trn in trndat:
             empno = CCD(trn[tc.index("wlt_empno")], "UI", 5)
             loan = CCD(trn[tc.index("wlt_loan")], "UI", 2)
             trdt = CCD(trn[tc.index("wlt_trdt")], "D1", 10)
             ref = CCD(trn[tc.index("wlt_ref")], "Na", 9)
             amt = CCD(trn[tc.index("wlt_amt")], "SD", 13.2)
             ded = CCD(trn[tc.index("wlt_ded")], "SD", 13.2)
             per = CCD(trn[tc.index("wlt_per")], "UD", 6.2)
             desc = CCD(trn[tc.index("wlt_desc")], "NA", 15)
             if self.pglin > self.fpdf.lpp:
                 self.pageHeading()
             self.fpdf.drawText("%s %s %s %s %s %s %s %s" %
                 (empno.disp, loan.disp, trdt.disp, ref.disp,
                 per.disp, amt.disp, ded.disp, desc.disp))
             self.btot[0] = self.btot[0] + 1
             self.btot[1] = float(ASD(self.btot[1]) + ASD(amt.work))
             self.pglin += 1
         self.batchTotal()
     p.closeProgress()
     if self.fpdf.page and not p.quit:
         pdfnam = getModName(self.opts["mf"].rcdic["wrkdir"],
             self.__class__.__name__, self.opts["conum"], ext="pdf")
         self.fpdf.output(pdfnam, "F")
         doPrinter(mf=self.opts["mf"], conum=self.opts["conum"],
             pdfnam=pdfnam, header=self.tit, repprt=self.df.repprt,
             fromad=self.fromad, repeml=self.df.repeml)
     else:
         showError(self.opts["mf"].body, "Batch Errors",
             "No Batch Transactions")
Beispiel #24
0
 def doCreate(self):
     newdata = []
     for pag in range((self.df.pgs + 1)):
         newdata.extend(self.df.t_work[pag][0])
     keys = self.sql.getRec("ftable",
                            where=[("ft_tabl", "=", self.table),
                                   ("ft_type", "=", "U")])
     for key in keys:
         col = []
         dat = []
         for fld in key[4:]:
             if fld:
                 col.append(fld)
                 idx = getattr(self.sqi, "%s_col" % self.table)
                 dat.append(newdata[idx.index(fld)])
         whr = []
         for num, ccc in enumerate(col):
             whr.append((ccc, "=", dat[num]))
         chk = self.sqi.getRec(tables=self.table, where=whr)
         if chk:
             showError(self.opts["mf"].body, "Duplicate Key",
                       "A Record like this Already Exists")
             return
     self.sqi.insRec(self.table, data=newdata)
     self.doReset()
Beispiel #25
0
 def doGenInt(self, cono, amnt):
     # General Ledger Transaction (Intercompany From)
     acc = self.sql.getRec("genint",
                           cols=["cti_acno"],
                           where=[("cti_cono", "=", self.opts["conum"]),
                                  ("cti_inco", "=", cono)],
                           limit=1)
     if not acc:
         showError(
             self.opts["mf"].body, "Inter Company Error",
             "Invalid Account %s for Company %s in %s" %
             (acc, cono, self.opts["conum"]))
         return "err"
     self.doGenTrn(self.opts["conum"], acc[0], amnt)
     # General Ledger Transaction (Intercompany To)
     acc = self.sql.getRec("genint",
                           cols=["cti_acno"],
                           where=[("cti_cono", "=", cono),
                                  ("cti_inco", "=", self.opts["conum"])],
                           limit=1)
     if not acc:
         showError(
             self.opts["mf"].body, "Inter Company Error",
             "Invalid Account %s for Company %s in %s" %
             (acc, self.opts["conum"], cono))
         return "err"
     amnt = float(ASD(0) - ASD(amnt))
     self.doGenTrn(cono, acc[0], amnt)
Beispiel #26
0
 def doEnd(self):
     self.df.closeProcess()
     if self.whole == "S":
         self.recs = getSingleRecords(self.opts["mf"],
                                      "genmst", ("glm_acno", "glm_desc"),
                                      where=[("glm_cono", "=",
                                              self.opts["conum"])],
                                      items=[0, self.accs])
     elif self.whole == "R":
         self.recs = self.sql.getRec("genmst",
                                     where=[("glm_cono", "=",
                                             self.opts["conum"]),
                                            ("glm_acno", "between",
                                             self.sacno, self.eacno)],
                                     order="glm_acno")
     else:
         self.recs = self.sql.getRec("genmst",
                                     where=[("glm_cono", "=",
                                             self.opts["conum"])],
                                     order="glm_acno")
     if not self.recs:
         showError(self.opts["mf"].body, "Error", "No Accounts Selected")
     elif self.df.repprt[2] == "export":
         self.exportReport(self.recs)
     else:
         self.printReport(self.recs)
     self.doExit()
Beispiel #27
0
 def doDat(self, frt, pag, r, c, p, i, w):
     self.pro = False
     self.ynd = False
     if w > self.nne:
         showError(self.opts["mf"].body, "Month End Error",
                   "More than Two Month Ends are Missing, Aborting ...")
         return "rf"
     if w > self.nme:
         if self.nme == self.opts["period"][2][0]:
             ok = askQuestion(self.opts["mf"].body, "Year End Error",
                 "A Year End as at %s Has Not Been Run\n\n"\
                 "Would You Like to Raise Pro-Forma Charges?" %
                 self.opts["period"][2][1])
             if ok == "yes":
                 self.pro = True
                 self.ynd = True
         else:
             ok = askQuestion(self.opts["mf"].body, "Month End Error",
                 "A Month End as at %s Has Not Been Run\n\n"\
                 "Would You Like to Raise Pro-Forma Charges?" %
                 CCD(self.nme, "D1", 10).disp)
             if ok == "yes":
                 self.pro = True
     self.datew = w
     self.dated = self.df.t_disp[pag][0][p]
     self.curdt = int(w / 100)
Beispiel #28
0
 def doFrom(self, frt, pag, r, c, p, i, w):
     if sys.platform == "win32":
         if w.lower() == self.opts["mf"].rcdic["name"].lower():
             return "Invalid RC File (1)"
     elif w == self.opts["mf"].rcdic["name"]:
         return "Invalid RC File (2)"
     rcdic = loadRcFile(w)
     if rcdic == "error":
         return "Invalid RC File Format"
     elif not rcdic:
         return "Invalid RC File (3)"
     try:
         self.dbm = Dbase(rcdic)
         if self.dbm.err:
             raise Exception
         self.dbm.openDbase()
         self.sql = Sql(self.dbm, ["verupd", "ftable", "ffield"],
                        prog=self.__class__.__name__)
         verb = self.sql.getRec("verupd", limit=1)
         if verb:
             verb = verb[0]
         if verb != self.vera:
             showError(self.opts["mf"].body, "Version Error",
                 "The version (%s) of the source database does not agree "\
                 "with the version (%s) of the receiving database.\n\n"\
                 "You must ensure that these versions do agree before "\
                 "attempting to copy tables." % (verb, self.vera))
             return "Version Error"
     except:
         return "Invalid RC File (4)"
     if not self.dbm.db:
         return "Invalid RC File (5)"
Beispiel #29
0
 def endPage(self):
     self.df.closeProcess()
     col = [
         "stv_group", "stv_code", "stv_loc", "stv_bin", "stv_qty",
         "stv_ucost", "stv_usell"
     ]
     recs = self.sql.getRec(tables=["strmf1", "strvar"],
                            cols=col,
                            where=[("stv_cono", "=", self.opts["conum"]),
                                   ("stv_cono=st1_cono", ),
                                   ("stv_group=st1_group", ),
                                   ("stv_code=st1_code", )],
                            order="stv_group, stv_code, stv_loc")
     if not recs:
         showError(self.opts["mf"].body, "Processing Error",
                   "No Records Selected")
     else:
         p = ProgressBar(self.opts["mf"].body, typ="F", mxs=len(recs))
         for num, dat in enumerate(recs):
             p.displayProgress(num)
             self.updateTables(num + 1, col, dat)
             self.sql.delRec(
                 "strvar",
                 where=[("stv_cono", "=", self.opts["conum"]),
                        ("stv_group", "=", dat[col.index("stv_group")]),
                        ("stv_code", "=", dat[col.index("stv_code")]),
                        ("stv_loc", "=", dat[col.index("stv_loc")])])
         self.opts["mf"].dbm.commitDbase()
         p.closeProgress()
     self.opts["mf"].closeLoop()
Beispiel #30
0
 def doEnd(self):
     self.df.closeProcess()
     if not self.group:
         self.sgrp = ""
         self.egrp = "zzz"
     else:
         self.sgrp = self.group
         self.egrp = self.group
     whr = [("st1_cono", "=", self.opts["conum"]),
            ("st1_group", ">=", self.sgrp), ("st1_group", "<=", self.egrp)]
     if self.itype != "A":
         whr.append(("st1_type", "=", self.itype))
     whr.extend([("unm_cono=st1_cono", ), ("unm_unit=st1_uoi", )])
     recs = self.sql.getRec(tables=["strmf1", "struoi"],
                            cols=[
                                "st1_group", "st1_code", "st1_type",
                                "st1_desc", "st1_uoi", "unm_desc"
                            ],
                            where=whr,
                            order="st1_group, st1_code")
     if not recs:
         showError(self.opts["mf"].body, "Processing Error",
                   "No Records Selected")
     elif self.df.repprt[2] == "export":
         self.exportReport(recs)
     else:
         self.printReport(recs)
     self.closeProcess()