def doPrint(self): if self.repeml[1] == "Y" and not self.emadd: key = "%s_%s_%s_%s" % (self.opts["conum"], self.own, self.prm, self.acc) else: key = "%s_all_all_all" % self.opts["conum"] pdfnam = getModName(self.opts["mf"].rcdic["wrkdir"], self.__class__.__name__, key, ext="pdf") self.form.output(pdfnam, "F") doPrinter(mf=self.opts["mf"], conum=self.opts["conum"], pdfnam=pdfnam, header="%s Statement at %s" % (self.opts["conam"], self.dated), fromad=self.fromad, repprt=self.repprt, repeml=self.repeml) if self.repeml[1] == "Y": self.form = DrawForm(self.opts["mf"].dbm, self.tname, wrkdir=self.opts["mf"].rcdic["wrkdir"]) self.doLoadStatic() self.form.doNewDetail()
def __init__(self, **opts): self.opts = opts if self.setVariables(): if "args" in self.opts: self.own, self.prm, self.acc, self.datew, self.dated, \ self.repprt, self.repeml = self.opts["args"] self.emadd = self.repeml[2] self.tname = self.stpl self.zeros = "Y" self.minus = "Y" self.mesno = 0 whr = [("rtn_cono", "=", self.opts["conum"]), ("rtn_owner", "=", self.own), ("rtn_code", "=", self.prm), ("rtn_acno", "=", self.acc)] rtn = self.sql.getRec("rcatnm", where=whr, limit=1) self.form = DrawForm(self.opts["mf"].dbm, self.tname, wrkdir=self.opts["mf"].rcdic["wrkdir"]) self.doLoadStatic() self.form.doNewDetail() self.doProcess(rtn) if self.form.page and (self.repeml[1] == "N" or self.emadd): self.repeml[2] = self.emadd self.doPrint() else: self.mainProcess() self.opts["mf"].startLoop()
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()
def doEnd(self): self.df.closeProcess() self.emadd = self.df.repeml[2] if not self.echn: self.echn = 999 if not self.eacc: self.eacc = "zzzzzzz" whr = [("drm_cono", "=", self.opts["conum"]), ("drm_chain", ">=", self.schn), ("drm_acno", ">=", self.sacc), ("drm_chain", "<=", self.echn), ("drm_acno", "<=", self.eacc)] if self.stops == "N": whr.append(("drm_stop", "<>", "Y")) if self.redu == "N": whr.append(("drm_stat", "<>", "X")) if self.whole == "S": recs = getSingleRecords(self.opts["mf"], "drsmst", ("drm_chain", "drm_acno", "drm_name"), where=whr) else: if self.sort == "N": odr = "drm_chain, drm_acno" elif self.sort == "M": odr = "drm_name" else: odr = "drm_pcod" recs = self.sql.getRec("drsmst", where=whr, order=odr) if not recs: showError(self.opts["mf"].body, "Error", "No Accounts Selected") else: 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 self.emadd: self.df.repeml[2] = self.emadd self.doPrint() self.opts["mf"].closeLoop()
def doEnd(self): self.df.closeProcess() if self.excepts == "Y": self.doExceptions() self.emadd = self.df.repeml[2] if self.bestac: self.export = open( os.path.join( self.opts["mf"].rcdic["wrkdir"], "best%03d_%s.txt" % (self.opts["conum"], self.paydtw)), "w") # Header for BEST self.export.write("%1s%4s%-40s%8s%1s%8s%-15s%1s%2s%1s%9s%2s%4s"\ "\r\n" % ("*", self.bestac, self.opts["conam"], self.paydtw, "Y", "", "CREDITORS EFT", "+", self.besttp, 0, "", "01", "LIVE")) else: self.export = None if self.whole == "S": recs = getSingleRecords(self.opts["mf"], "crsmst", ("crm_acno", "crm_name"), where=[("crm_cono", "=", self.opts["conum"]), ("crm_termsb", "=", self.freq), ("crm_pyind", "<>", "N"), ("crm_stat", "<>", "X")]) else: if not self.eacc: self.eacc = "zzzzzzz" whr = [("crm_cono", "=", self.opts["conum"]), ("crm_acno", "between", self.sacc, self.eacc), ("crm_termsb", "=", self.freq), ("crm_pyind", "<>", "N"), ("crm_stat", "<>", "X")] if self.sort == "N": odr = "crm_acno" elif self.sort == "M": odr = "crm_name" else: odr = "crm_pcod" recs = self.sql.getRec("crsmst", 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: self.opts["mf"].dbm.rollbackDbase() break self.doProcess(rec) p.closeProgress() if p.quit or not self.form.page: pass elif self.df.repeml[1] == "N" or self.emadd: self.df.repeml[2] = self.emadd self.doPrint() if self.bestac: # Trailer for BEST value = int(round((self.etotal * 100), 0)) self.export.write("%1s%4s%1s%30s%013u%47s\r\n" % \ (2, self.bestac, "T", "", value, "")) self.export.close() if self.glint == "Y" and self.etotal: # Create total transactions in GL data = [ self.opts["conum"], self.crsctl, self.curdt, self.paydtw, 2, self.refno, self.batno, self.etotal, 0.0, "Payment EFT%06i to EFT%06i" % (self.refs, self.cats), "", "", 0, self.opts["capnm"], self.sysdtw, 0 ] self.sql.insRec("gentrn", data=data) data[1] = self.bankac data[7] = float(ASD(0) - ASD(self.etotal)) self.sql.insRec("gentrn", data=data) self.opts["mf"].dbm.commitDbase( ask=True, mess="""Would you like to commit all elecronic payments? If you decide to do this, you must remember to upload the BEST file to the Bank otherwise you are NOT going to Reconcile!""", default="no") if "wait" not in self.opts: self.opts["mf"].closeLoop()
def doEnd(self): if "args" in self.opts: self.whole = "S" self.current = "N" self.zeros = "Y" self.paid = "Y" self.minus = "Y" self.mes = None self.mes = self.sql.getRec("ctlmes", cols=["mss_detail"], where=[("mss_system", "=", "MEM"), ("mss_message", "=", 1)], limit=1) self.curdt = int(self.opts["args"][1] / 100) self.dated = CCD(self.opts["args"][1], "D1", 10).disp self.pro = False self.repprt = self.opts["args"][2] self.repeml = self.opts["args"][3] recs = [self.opts["args"][0]] else: self.df.closeProcess() self.repprt = self.df.repprt self.repeml = self.df.repeml whr = [("mlm_cono", "=", self.opts["conum"])] if self.status != "Z": # Not All whr.append(("mlm_state", "=", self.status)) if self.sort == "N": odr = "mlm_memno" else: odr = "mlm_surname" if self.whole == "S": recs = getSingleRecords( self.opts["mf"], "memmst", ("mlm_memno", "mlm_surname", "mlm_names"), head=["X", "Number", "Surname", "Names"], where=whr, order=odr, selcol="mlm_surname") else: if self.whole == "R": whr.append(("mlm_memno", "between", self.start, self.to)) recs = self.sql.getRec("memmst", where=whr, order=odr) if not recs: showError(self.opts["mf"].body, "Error", "No Accounts Selected") if "wait" not in self.opts: self.opts["mf"].closeLoop() return # Remove all linked accounts col = self.sql.memmst_col nos = [] for acc in recs: nos.append(acc[col.index("mlm_memno")]) chk = copyList(recs) for acc in chk: whr = [("mll_cono", "=", self.opts["conum"]), ("mll_lnkno", "=", acc[col.index("mlm_memno")])] lnk = self.sql.getRec("memlnk", where=whr, limit=1) if lnk and lnk[1] in nos: recs.remove(acc) if recs: self.emadd = self.repeml[2] self.form = DrawForm(self.opts["mf"].dbm, self.tname, wrkdir=self.opts["mf"].rcdic["wrkdir"]) self.doLoadStatic() self.form.doNewDetail() if self.repeml[1] == "N": mess = "Printing Statements" else: mess = "Printing and Emailing Statements" p = ProgressBar(self.opts["mf"].body, typ=mess, mxs=len(recs), esc=True) for num, rec in enumerate(recs): p.displayProgress(num) if p.quit: break if self.pro: self.doProForma(rec) self.doProcess(rec) p.closeProgress() if self.pro: self.opts["mf"].dbm.rollbackDbase() if p.quit or not self.form.page: pass elif self.repeml[1] == "N" or self.emadd: self.repeml[2] = self.emadd self.doPrint() if "wait" not in self.opts: self.opts["mf"].closeLoop()
def doEnd(self): if "args" in self.opts: self.cancel = "Y" self.tname = self.stpl self.whole = "A" self.snum = 0 self.enum = 0 if len(self.opts["args"]) == 1: self.repprt = ["N", "V", "view"] self.repeml = ["N", "N", "", "", "Y"] else: self.repprt = self.opts["args"][1] self.repeml = self.opts["args"][2] else: self.df.closeProcess() self.repprt = self.df.repprt self.repeml = self.df.repeml if not self.enum: self.enum = 9999999 self.emadd = self.repeml[2] tab = ["bkmmst"] whr = [("bkm_cono", "=", self.opts["conum"])] if self.cancel == "N": whr.append(("bkm_state", "<>", "X")) odr = "bkm_number" if self.whole == "A": if type(self.opts["args"][0]) == int: whr.append(("bkm_number", "=", self.opts["args"][0])) else: whr.append(("bkm_number", "in", self.opts["args"][0])) recs = self.sql.getRec("bkmmst", where=whr, order=odr) elif self.whole == "S": tab.append("bkmcon") col = ["bkm_number", "bkc_sname", "bkc_names"] whr.extend([("bkc_cono=bkm_cono", ), ("bkc_ccode=bkm_ccode", )]) dic = {} for c in col: for t in tab: d = getattr(self.sql, "%s_dic" % t) if c in d: dic[c] = d[c] data = self.sql.getRec(tables=tab, cols=col, where=whr, order=odr) data = getSingleRecords(self.opts["mf"], tab, col, dic=dic, where=data, ttype="D") recs = [] for dat in data: acc = self.sql.getRec("bkmmst", where=[("bkm_cono", "=", self.opts["conum"]), ("bkm_number", "=", dat[0])]) recs.append(acc[0]) else: if self.whole == "R": whr.extend([("bkm_number", ">=", self.snum), ("bkm_number", "<=", self.enum)]) recs = self.sql.getRec("bkmmst", where=whr, order=odr) if not recs: showError(self.opts["mf"].body, "Error", "No Bookings Selected") else: 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.repeml[1] == "N" or self.emadd: self.repeml[2] = self.emadd self.doPrint() if "wait" not in self.opts: self.opts["mf"].closeLoop()