Пример #1
0
 def getValues(self, data):
     acc = CCD(data[0], "UI", 6)
     name = CCD("%s, %s %s" % (data[3], data[1], data[2]), "NA", 30)
     bals = Balances(self.opts["mf"],
                     "MEM",
                     self.opts["conum"],
                     self.cutoff,
                     keys=(acc.work, ))
     obal, cbal, ages = bals.doAllBals()
     bal = CCD(cbal, "SD", 13.2)
     if self.limit and bal.work < self.limit:
         return
     if self.zero == "Y" and not bal.work:
         return
     if self.credit == "N" and bal.work < 0:
         return
     if self.onlycr == "Y" and bal.work >= 0:
         return
     cur = CCD(ages[0], "SD", 13.2)
     d30 = CCD(ages[1], "SD", 13.2)
     d60 = CCD(ages[2], "SD", 13.2)
     d90 = CCD(ages[3], "SD", 13.2)
     d120 = CCD(ages[4], "SD", 13.2)
     if bal.work < 0:
         deb = CCD(bal.work, "SD", 13.2)
     else:
         deb = CCD(0, "SD", 13.2)
     self.gtots[0] = float(ASD(self.gtots[0]) + ASD(deb.work))
     self.gtots[1] = float(ASD(self.gtots[1]) + ASD(bal.work))
     self.gtots[2] = float(ASD(self.gtots[2]) + ASD(cur.work))
     self.gtots[3] = float(ASD(self.gtots[3]) + ASD(d30.work))
     self.gtots[4] = float(ASD(self.gtots[4]) + ASD(d60.work))
     self.gtots[5] = float(ASD(self.gtots[5]) + ASD(d90.work))
     self.gtots[6] = float(ASD(self.gtots[6]) + ASD(d120.work))
     return (acc, name, deb, bal, cur, d30, d60, d90, d120)
Пример #2
0
 def doDetail(self, recs):
     for num, dat in enumerate(recs):
         self.p.displayProgress(num)
         if self.p.quit:
             break
         self.odr = CCD(dat[0], "Na", 9)
         self.pot = self.sql.getRec(
             "strpot",
             cols=[
                 "pot_group", "pot_code", "pot_uoi", "pot_desc", "pot_qty",
                 "pot_price", "pot_disper"
             ],
             where=[("pot_cono", "=", self.opts["conum"]),
                    ("pot_ordno", "=", self.odr.work)],
             order="pot_group, pot_code")
         self.dto = CCD(dat[2], "d1", 10)
         self.crs = CCD(dat[3], "NA", 7)
         acc = self.sql.getRec("crsmst",
                               cols=["crm_name"],
                               where=[("crm_cono", "=", self.opts["conum"]),
                                      ("crm_acno", "=", self.crs.work)],
                               limit=1)
         if not acc:
             self.nam = ""
         else:
             self.nam = acc[0]
         self.dte = CCD(dat[4], "d1", 10)
         self.printHeader()
         if self.pot:
             self.printBody()
         else:
             self.fpdf.drawText("No Products on Order - Please "\
                 "Amend or Cancel the Order")
     self.p.closeProgress()
Пример #3
0
 def printDeposit(self, recs):
     tot1 = 0
     tot2 = 0
     tot3 = 0
     for ct in recs:
         date = CCD(ct[0], "D1", 10)
         move = CCD(ct[1], "SD", 13.2)
         days = CCD(ct[2], "UI", 5)
         rate = CCD(ct[3], "UD", 5.2)
         intr = CCD(ct[4], "SD", 13.2)
         bals = CCD(ct[5], "SD", 13.2)
         admn = CCD(ct[6], "SD", 13.2)
         tot1 = float(ASD(tot1) + ASD(move.work))
         tot2 = float(ASD(tot2) + ASD(intr.work))
         tot3 = float(ASD(tot3) + ASD(admn.work))
         if self.pglin > self.fpdf.lpp:
             self.pageHeading()
             self.pageHeadingDeposit()
         self.fpdf.drawText("%s %s %s %s %s %s %s" % (date.disp, move.disp,
             days.disp, rate.disp, intr.disp, bals.disp, admn.disp))
         self.pglin += 1
     self.fpdf.setFont(style="B")
     self.fpdf.underLine(txt=self.head)
     move = CCD(tot1, "SD", 13.2)
     intr = CCD(tot2, "SD", 13.2)
     admn = CCD(tot3, "SD", 13.2)
     self.fpdf.drawText("%-10s %s %11s %s %s %s" % ("Totals", move.disp, "",
         intr.disp, bals.disp, admn.disp))
Пример #4
0
 def doPrintCatTotal(self, ttype="P", page=True):
     rates = list(self.ttipv[self.pcat].keys())
     rates.sort()
     for num, rte in enumerate(rates):
         j = CCD(self.ttipv[self.pcat][rte], "SD", 13.2)
         k = CCD(self.ttipt[self.pcat][rte], "SD", 13.2)
         l = CCD(self.ttopv[self.pcat][rte], "SD", 13.2)
         m = CCD(self.ttopt[self.pcat][rte], "SD", 13.2)
         if not j.work and not k.work and not l.work and not m.work:
             continue
         if ttype == "P":
             if not num:
                 self.fpdf.drawText(self.fpdf.suc * 135)
             self.fpdf.drawText("%-41s %-14s %-15s %-6s "\
                 "%-13s %-13s %-13s %-13s" % ("", "Category-Total",
                 self.pcat, rte, j.disp, k.disp, l.disp, m.disp))
         else:
             if not num:
                 self.expdatas.append(["ULINES"])
             desc = "Category-Total %s" % self.pcat
             line = [
                 "TOTAL",
                 [
                     "", "", "", "", "", "", "", "", desc, rte, j.work,
                     k.work, l.work, m.work
                 ]
             ]
             self.expdatas.append(line)
Пример #5
0
 def doPrintCodeTotal(self, ttype="P", line=True):
     j = CCD(self.ctipv, "SD", 13.2)
     k = CCD(self.ctipt, "SD", 13.2)
     l = CCD(self.ctopv, "SD", 13.2)
     m = CCD(self.ctopt, "SD", 13.2)
     if ttype == "P":
         if self.totsonly != "Y" and line:
             self.fpdf.drawText(self.fpdf.suc * 135)
         self.fpdf.drawText(
             "%-41s %-14s %-22s %-13s %-13s %-13s %-13s" %
             ("", "Code-Total", self.pcode, j.disp, k.disp, l.disp, m.disp))
     else:
         self.expdatas.append(["ULINES"])
         desc = "Code-Total %s" % self.pcode
         line = [
             "TOTAL",
             [
                 "", "", "", "", "", "", "", "", desc, "", j.work, k.work,
                 l.work, m.work
             ]
         ]
         self.expdatas.append(line)
     self.ctipv = 0
     self.ctipt = 0
     self.ctopv = 0
     self.ctopt = 0
Пример #6
0
 def __init__(self, **opts):
     self.opts = opts
     if self.setVariables():
         if "args" in self.opts:
             self.ptyp, self.sperw, self.eperw, self.btyp, self.batch = \
                 self.opts["args"]
             self.sperd = CCD(self.sperw, "d2", 7).disp
             self.eperd = CCD(self.eperw, "d2", 7).disp
             self.totsonly = "N"
             self.whr = [("mlt_cono", "=", self.opts["conum"])]
             if self.ptyp == "F":
                 self.whr.append(
                     ("mlt_curdt", "between", self.sperw, self.eperw))
             else:
                 self.whr.append(
                     ("mlt_capdt", "between", self.sdatw, self.edatw))
             if self.btyp:
                 self.whr.append(("mlt_type", "=", self.btyp))
             self.whr.append(("mlt_batch", "=", self.batch))
             self.processRecords()
         else:
             self.sper = int(self.opts["period"][1][0] / 100)
             self.eper = int(self.opts["period"][2][0] / 100)
             self.mainProcess()
             if "wait" in self.opts:
                 self.df.mstFrame.wait_window()
             else:
                 self.opts["mf"].startLoop()
Пример #7
0
 def grandTotal(self):
     costsd = ""
     salesd = ""
     proftd = ""
     prperd = ""
     mchart = ["T", "Grand Totals"]
     for x in range(11,-1,-1):
         c = CCD(self.ctots[x], "SL", 11)
         s = CCD(self.stots[x], "SL", 11)
         prf = float(ASD(s.work) - ASD(c.work))
         prf = CCD(prf, "SL", 11)
         if s.work == 0:
             pcn = 0
         else:
             pcn = round((prf.work * 100.0 / s.work), 2)
         pcn = CCD(pcn, "SD", 11.2)
         self.ctots[x] = self.ctots[x] + c.work
         self.stots[x] = self.stots[x] + s.work
         costsd = costsd + c.disp
         salesd = salesd + s.disp
         proftd = proftd + prf.disp
         prperd = prperd + pcn.disp
         mchart.append(s.work)
     self.mchart.append(mchart)
     self.fpdf.drawText("%-3s %-6s %30s %s" % ("", "Totals", "Sales ",
         salesd))
     self.fpdf.drawText("%-34s %s %s" % ("", "Costs ", costsd))
     self.fpdf.drawText("%-34s %s %s" % ("", "Profit", proftd))
     self.fpdf.drawText("%-34s %s %s" % ("", "Prf-% ", prperd))
     self.fpdf.underLine(txt=self.head)
     self.fpdf.drawText()
Пример #8
0
 def doProcess(self, dat):
     loc, group, code, desc, valind, vatcod = dat
     icost, bal = getCost(self.sql, self.opts["conum"], group, code,
         loc=loc, qty=1, ind="I", bal=True)
     if self.outs == "N" and not bal[0]:
         return
     if self.ccode:
         # Calculate cost price code
         cost = CCD(int(icost * 100), "UI", 9)
         ncost = " " * (9 - len(str(cost.work)))
         for x in str(cost.work):
             ncost = ncost + self.ccode[int(x)]
         lab = "%-30s %13s" % (self.df.t_disp[0][0][0], ncost)
     else:
         lab = "%-30s" % self.df.t_disp[0][0][0]
     ####################################################################
     lab = "%s\n%s %s %s" % (lab, loc, group, code)
     lab = "%s\n%s\n" % (lab, desc)
     prc = getSell(self.sql, self.opts["conum"], group, code, loc)
     price1 = CCD(prc, "UD", 9.2)
     vrte = getVatRate(self.sql, self.opts["conum"], vatcod, self.date)
     if vrte is None:
         vrte = CCD(0, "UD", 9.2)
     else:
         vrte = CCD(vrte, "UD", 9.2)
     price2 = CCD(round((price1.work * float(ASD(100) + \
         ASD(vrte.work)) / 100.0), 2), "OUD", 9.2)
     lab = "%s\n%s %s %s" % (lab, vatcod, price1.disp, price2.disp)
     self.fpdf.add_label(lab)
Пример #9
0
 def getOrdTot(self):
     self.total_taxable = 0
     self.total_nontaxable = 0
     self.total_tax = 0
     self.total_value = 0
     col = self.sql.slsiv2_col
     for dat in self.si2:
         dis = CCD(dat[col.index("si2_disc_per")], "UD", 6.2)
         qty = CCD(dat[col.index("si2_qty")], "SD", 13.2)
         pri = CCD(dat[col.index("si2_price")], "UD", 12.2)
         vat = CCD(dat[col.index("si2_vat_rate")], "UD", 6.2)
         excpri = round((pri.work * 1), 2)
         incrat = float(ASD(100.0) + ASD(vat.work))
         incpri = round((pri.work * incrat / 100.0), 4)
         net = float(ASD(100.0) - ASD(dis.work))
         excamt = round((qty.work * excpri * net / 100.0), 2)
         incamt = round((qty.work * incpri * net / 100.0), 2)
         vatamt = float(ASD(incamt) - ASD(excamt))
         if excamt == incamt:
             self.total_nontaxable = float(ASD(self.total_nontaxable) + \
                 ASD(excamt))
         else:
             self.total_taxable = float(ASD(self.total_taxable) + \
                 ASD(excamt))
         self.total_tax = float(ASD(self.total_tax) + ASD(vatamt))
         self.total_value = float(ASD(self.total_value) + ASD(incamt))
     self.slstot[0] = float(ASD(self.slstot[0]) + ASD(self.total_taxable))
     self.slstot[1] = float(
         ASD(self.slstot[1]) + ASD(self.total_nontaxable))
     self.slstot[2] = float(ASD(self.slstot[2]) + ASD(self.total_tax))
     self.slstot[3] = float(ASD(self.slstot[3]) + ASD(self.total_value))
Пример #10
0
 def doPremises(self, frt, pag, r, c, p, i, w):
     acc = self.sql.getRec("rtlprm",
                           cols=["rtp_desc"],
                           where=[("rtp_cono", "=", self.opts["conum"]),
                                  ("rtp_code", "=", w)],
                           limit=1)
     if not acc:
         return "Invalid Premises"
     self.code = w
     col = ["rtc_payind", "rtc_start", "rtc_period"]
     whr = [("rtc_cono", "=", self.opts["conum"]),
            ("rtc_code", "=", self.code), ("rtc_status", "=", "C")]
     chk = self.sql.getRec("rtlcon",
                           cols=col,
                           where=whr,
                           order="rtc_start desc")
     if not chk:
         self.end = 0
         return
     freq, start, period = chk[0]
     if freq == "M":
         self.end = CCD(projectDate(start, period, "months"), "D1", 10)
     elif freq == "3":
         self.end = CCD(projectDate(start, period * 3, "months"), "D1", 10)
     elif freq == "6":
         self.end = CCD(projectDate(start, period * 6, "months"), "D1", 10)
     else:
         self.end = CCD(projectDate(start, period, "years"), "D1", 10)
Пример #11
0
 def doProcess(self, emp):
     self.totbal = 0
     wlc = self.sql.waglmf_col
     self.emp = CCD(emp[wlc.index("wlm_empno")], "UI", 5)
     whr = [("wgm_cono", "=", self.opts["conum"]),
            ("wgm_empno", "=", self.emp.work)]
     col = ("wgm_sname", "wgm_fname", "wgm_emadd")
     mst = self.sql.getRec("wagmst", where=whr, cols=col, limit=1)
     self.nam = CCD(mst[0] + ", " + mst[1], "NA", 60)
     self.lon = CCD(emp[wlc.index("wlm_loan")], "UI", 2)
     self.des = CCD(emp[wlc.index("wlm_desc")], "NA", 30)
     whr = [("wlt_cono", "=", self.opts["conum"]),
            ("wlt_empno", "=", self.emp.work),
            ("wlt_loan", "=", self.lon.work)]
     col = ("wlt_trdt", "wlt_type", "wlt_ref", "wlt_batch", "wlt_per",
            "wlt_amt", "wlt_ded", "wlt_desc")
     odr = "wlt_trdt, wlt_type, wlt_ref"
     wlt = self.sql.getRec("wagltf", where=whr, cols=col, order=odr)
     if wlt:
         self.loadBalances(wlt)
         if self.paidup == "Y" and not self.cbal:
             pass
         else:
             self.printHeader()
             self.printBody(wlt)
             if self.df.repeml[1] == "Y":
                 self.df.repeml[2] = mst[2]
                 self.doPrint()
Пример #12
0
 def doGetCharge(self, ctyp, code, date):
     prc = self.sql.getRec("memctp",
                           where=[("mcp_cono", "=", self.opts["conum"]),
                                  ("mcp_type", "=", ctyp),
                                  ("mcp_code", "=", code),
                                  ("mcp_date", "<=", date)],
                           order="mcp_date desc",
                           limit=1)
     if not prc:
         # No Price
         return
     if prc[5] == "N" or (self.ynd and date == self.datew):
         # Not Pro Rata or End of Financial Year
         amt = CCD(prc[6], "UD", 12.2).work
     else:
         # Extract Pro Rata Rate
         mths = 17 - dateDiff(date, self.opts["period"][2][0], "months")
         if mths < 1:
             mths = 12
         amt = CCD(prc[mths], "UD", 12.2).work
     if not amt:
         # No Charge
         return
     else:
         return amt
Пример #13
0
 def doGenTrn(self, cono, acno, amnt, edes=None):
     if not edes:
         edes = "Salaries and Wages"
     batno = CCD("%03i%04i" % (self.opts["conum"], (self.curdt % 10000)),
                 "Na", 7)
     refno = CCD(1, "Na", 9)
     whr = [("glt_cono", "=", cono), ("glt_acno", "=", acno),
            ("glt_curdt", "=", self.curdt), ("glt_trdt", "=", self.rundt),
            ("glt_type", "=", 4), ("glt_refno", "=", refno.work),
            ("glt_batch", "=", batno.work), ("glt_desc", "=", edes)]
     trn = self.sql.getRec("gentrn",
                           cols=["glt_seq", "glt_tramt"],
                           where=whr,
                           limit=1)
     if not trn:
         data = [
             cono, acno, self.curdt, self.rundt, 4, refno.work, batno.work,
             amnt, 0.00, edes, "", "", 0, self.opts["capnm"], self.sysdtw, 0
         ]
         self.sql.insRec("gentrn", data=data)
     else:
         newamt = float(ASD(trn[1]) + ASD(amnt))
         self.sql.updRec("gentrn",
                         cols=["glt_tramt"],
                         data=[newamt],
                         where=[("glt_seq", "=", int(trn[0]))])
Пример #14
0
 def doProcess(self, crm):
     self.pgnum = 0
     self.totbal = 0
     cmc = self.sql.crsmst_col
     self.acno = CCD(crm[cmc.index("crm_acno")], "NA", 7)
     whr = [("crt_cono", "=", self.opts["conum"]),
            ("crt_acno", "=", self.acno.work)]
     odr = "crt_curdt, crt_trdt, crt_ref1"
     self.ctc, self.crt = getTrn(self.opts["mf"].dbm,
                                 "crs",
                                 dte=self.curdt,
                                 whr=whr,
                                 odr=odr)
     if self.crt:
         if self.prnt == "N":
             self.printSetup()
         self.name = CCD(crm[cmc.index("crm_name")], "NA", 30)
         self.add1 = CCD(crm[cmc.index("crm_add1")], "NA", 30)
         self.add2 = CCD(crm[cmc.index("crm_add2")], "NA", 30)
         self.add3 = CCD(crm[cmc.index("crm_add3")], "NA", 30)
         self.pcod = CCD(crm[cmc.index("crm_pcod")], "NA", 4)
         self.terms = CCD(crm[cmc.index("crm_terms")], "UI", 3)
         self.termsb = CCD(crm[cmc.index("crm_termsb")], "NA", 1)
         self.stday = CCD(crm[cmc.index("crm_stday")], "UI", 2)
         self.pydis = CCD(crm[cmc.index("crm_pydis")], "SD", 7.2)
         self.printHeader()
         self.printBody()
Пример #15
0
 def grandTotal(self):
     if self.df.repprt[2] == "export":
         self.expdatas.append(["ULINES"])
         self.expdatas.append(
             ["TOTAL", ["", "", "Grand Totals"] + self.gtots])
         self.expdatas.append(["ULINED"])
         return
     ldic = {}
     for x in range(0, 7):
         ldic["t%s" % x] = CCD(self.gtots[x], "SD", 13.2)
         if self.gtots[1] == 0:
             ldic["p%s" % x] = CCD(0, "SD", 13.2)
         else:
             ldic["p%s" % x] = CCD(
                 round((self.gtots[x] / self.gtots[1] * 100), 2), "OSD",
                 13.2)
     self.fpdf.drawText()
     self.fpdf.drawText("%-11s %-30s %13s %13s %13s %13s %13s %13s %13s" %
                        (" ", "Grand Totals", ldic["t0"].disp,
                         ldic["t1"].disp, ldic["t2"].disp, ldic["t3"].disp,
                         ldic["t4"].disp, ldic["t5"].disp, ldic["t6"].disp))
     self.fpdf.drawText()
     self.fpdf.drawText("%-11s %-30s %13s %13s %13s %13s %13s %13s %13s" %
                        (" ", "Percentages", ldic["p0"].disp,
                         ldic["p1"].disp, ldic["p2"].disp, ldic["p3"].disp,
                         ldic["p4"].disp, ldic["p5"].disp, ldic["p6"].disp))
Пример #16
0
 def doDate(self, frt, pag, r, c, p, i, w):
     if p == 0:
         self.frm = CCD(w, "d1", 10)
     elif w < self.frm.work:
         return "Invalid, Before From"
     else:
         self.too = CCD(w, "D1", 10)
Пример #17
0
 def printReport(self, recs):
     self.pglin = 999
     p = ProgressBar(self.opts["mf"].body, mxs=len(recs), esc=True)
     self.head = "%03u %-101s" % (self.opts["conum"], self.opts["conam"])
     self.fpdf = MyFpdf(name=self.__class__.__name__, head=self.head)
     for seq, dat in enumerate(recs):
         p.displayProgress(seq)
         if p.quit:
             break
         self.acno, self.desc, acctot = self.getAccValues(dat)
         trn = self.sql.getRec("gentrn", where=[("glt_cono", "=",
             dat[0]), ("glt_acno", "=", dat[1]), ("glt_curdt", ">=",
             self.sdate.work), ("glt_curdt", "<=", self.edate.work)],
             order="glt_acno, glt_curdt, glt_trdt, glt_type, glt_refno, "\
             "glt_batch")
         if acctot or trn:
             if self.pglin == 999 or self.pages == "Y":
                 self.pageHeading()
             else:
                 self.newAccount()
         if acctot:
             w1 = CCD(acctot, "SD", 13.2)
             self.fpdf.drawText("%-10s %-9s %-3s %-7s %-30s %-13s %-13s "\
                 "%-13s" % (self.sdate.disp + "-01", "", "", "",
                 "Opening Balance", "", "", w1.disp))
             self.pglin += 1
         for acc in trn:
             trdt, refno, trtp, batch, amt, dbt, crt, detail, curdt, \
                 curmth = self.getTrnValues(acc)
             if self.pglin > self.fpdf.lpp:
                 self.pageHeading()
                 bf = CCD(acctot, "SD", 13.2)
                 if bf.work:
                     self.fpdf.drawText(
                         "%32s %-30s %27s %13s" %
                         ("", "Brought Forward", "", bf.disp))
                     self.pglin += 1
             acctot = float(ASD(acctot) + ASD(amt.work))
             w1 = CCD(acctot, "SD", 13.2)
             self.fpdf.drawText("%-10s %-9s %-3s %-7s %-30s %13s %13s %13s"\
                 % (trdt.disp, refno.disp, gltrtp[(trtp.work - 1)][0],
                 batch.disp, detail.disp, dbt.disp, crt.disp, w1.disp))
             self.pglin += 1
         if self.pages == "Y" and (acctot or trn):
             self.pglin = 999
     p.closeProgress()
     if p.quit or not self.fpdf.page:
         return
     if "args" not in self.opts or "noprint" not in self.opts["args"]:
         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,
                   repeml=self.df.repeml)
Пример #18
0
 def printBody(self, wlt):
     for trn in wlt:
         dat = CCD(trn[0], "d1", 10)
         bat = CCD(trn[3], "Na", 7)
         typ = CCD(trn[1], "UI", 2)
         ref = CCD(trn[2], "Na", 9)
         per = CCD(trn[4], "UD", 7.2)
         amt = CCD(trn[5], "SD", 13.2)
         ded = CCD(trn[6], "SD", 13.2)
         des = CCD(trn[7], "NA", 30)
         if self.fdate and dat.work < self.fdate:
             continue
         if dat.work > self.ldate:
             continue
         if self.pglin > self.fpdf.lpp:
             self.printHeader()
             bal = CCD(self.obal, "SD", 13.2)
             if bal.work:
                 mess = "%-69s%s%-30s" % ("", bal.disp, " Brought Forward")
                 self.fpdf.drawText(mess)
                 self.pglin += 1
         self.obal = float(ASD(self.obal) + ASD(float(amt.work)))
         bal = CCD(self.obal, "SD", 13.2)
         mess = "%s %s %s %s %s %s %s %s %s" % \
             (dat.disp, sltrtp[typ.work - 1][0], ref.disp, bat.disp,
             per.disp, amt.disp, ded.disp, bal.disp, des.disp)
         self.fpdf.drawText(mess)
         self.pglin += 1
Пример #19
0
 def loadBalances(self):
     whr = [
         ("wlt_cono", "=", self.opts["conum"]),
         ("wlt_empno", "=", self.empno),
         ("wlt_loan", "=", self.loan)]
     odr = "wlt_trdt, wlt_type"
     self.wlt = self.sql.getRec("wagltf", where=whr, order=odr)
     if self.wlt:
         for rec in self.wlt:
             dat = CCD(rec[self.sql.wagltf_col.index("wlt_trdt")], "d1", 10)
             typ = CCD(rec[self.sql.wagltf_col.index("wlt_type")], "UI",  2)
             amt = CCD(rec[self.sql.wagltf_col.index("wlt_amt")], "SD",13.2)
             self.bal = float(ASD(self.bal) + ASD(amt.work))
             self.cap = float(ASD(self.cap) + ASD(amt.work))
             if typ.work == 1:
                 if dat.work >= self.opts["period"] and \
                         dat.work >= self.df.t_work[1][0][3]:
                     self.cap = float(ASD(self.cap) - ASD(amt.work))
                     self.due = float(ASD(self.due) + ASD(amt.work))
                 self.imt = float(ASD(self.imt) + ASD(amt.work))
                 self.idt = dat.work
             elif typ.work in (2, 3):
                 self.lon = float(ASD(self.lon) + ASD(amt.work))
             elif typ.work == 4:
                 self.pay = float(ASD(self.pay) + ASD(amt.work))
                 self.pdt = dat.work
             elif typ.work == 5:
                 self.adj = float(ASD(self.adj) + ASD(amt.work))
Пример #20
0
 def grandTotal(self):
     a = CCD(self.tots[0], "SD", 13.2)
     b = CCD(self.tots[1], "SD", 13.2)
     self.fpdf.drawText()
     self.fpdf.drawText("%-11s %-48s %13s %-11s %13s" % \
         (" ", "Grand Totals", a.disp, "", b.disp))
     self.fpdf.drawText()
Пример #21
0
 def doDate(self, frt, pag, r, c, p, i, w):
     if p == 0:
         self.frm = CCD(w, "d1", 10)
     elif w < self.frm.work:
         return "Invalid Date, Less than Start Date"
     else:
         self.too = CCD(w, "D1", 10)
Пример #22
0
 def updateTables(self, rec):
     bals = Balances(self.opts["mf"],
                     "STR",
                     self.opts["conum"],
                     int(self.sysdtw / 100),
                     keys=(rec[0], rec[1], rec[2],
                           ("P", self.opts["period"][0])))
     m_ob, m_mv, m_cb, y_ob, y_mv, y_cb, ac, lc, ls = bals.doStrBals()
     if self.minus == "N" and not ac and not lc:
         return
     fqty = CCD(y_cb[0], "SD", 12.2)
     fval = CCD(y_cb[1], "SD", 12.2)
     if self.minus == "Y" and fqty.work < 0:
         nqty = 0
     else:
         nqty = fqty.work
     if self.method == "L" and lc:
         nval = nqty * lc
     elif self.method == "A" and ac:
         nval = nqty * ac
     elif lc:
         nval = nqty * lc
     else:
         nval = nqty * ac
     dqty = float(ASD(nqty) - ASD(fqty.work))
     dval = float(ASD(nval) - ASD(fval.work))
     if not dqty and not dval:
         return
     # Stores Ledger Transaction
     if dqty >= 0:
         rtn = 5
     else:
         rtn = 6
     txt = "Revaluation"
     self.sql.insRec("strtrn",
                     data=[
                         self.opts["conum"], rec[0], rec[1], rec[2],
                         self.date, rtn, self.cnt, "ST-RVAL", "", dqty,
                         dval, 0, self.curdt, txt, 0, "", "", "STR", 0, "",
                         self.opts["capnm"], self.sysdtw, 0
                     ])
     if self.glint == "N":
         self.cnt = self.cnt + 1
         return
     # General Ledger Control Transaction (Stock On Hand)
     self.sql.insRec("gentrn",
                     data=[
                         self.opts["conum"], self.stk_soh, self.curdt,
                         self.date, 4, self.cnt, "ST-RVAL", dval, 0, txt,
                         "N", "", 0, self.opts["capnm"], self.sysdtw, 0
                     ])
     # General Ledger Control Transaction (Stock Reconciliation)
     val = float(ASD(0) - ASD(dval))
     self.sql.insRec("gentrn",
                     data=[
                         self.opts["conum"], self.stk_susp, self.curdt,
                         self.date, 4, self.cnt, "ST-RVAL", val, 0, txt,
                         "N", "", 0, self.opts["capnm"], self.sysdtw, 0
                     ])
Пример #23
0
 def grandTotal(self):
     j = CCD(self.gtots[0], "SD", 13.2)
     k = CCD(self.gtots[1], "SD", 13.2)
     l = CCD(self.gtots[2], "SD", 13.2)
     self.fpdf.drawText()
     self.fpdf.drawText("%-34s %13s %-13s %13s" % \
         ("Grand Totals", j.disp, k.disp, l.disp))
     self.fpdf.drawText()
Пример #24
0
 def mainProcess(self):
     data = []
     p = ProgressBar(self.opts["mf"].body,
                     typ="Generating the Report",
                     mxs=len(self.notes.data),
                     esc=True)
     for num, dat in enumerate(self.notes.data):
         p.displayProgress(num)
         if p.quit:
             break
         if len(dat[2].strip()) < 14:
             continue
         desc = textFormat(dat[5], width=50)
         for n, d in enumerate(desc):
             if not n:
                 own = dat[2][:7].strip()
                 cod = dat[2][7:14].strip()
                 acc = dat[2][14:].strip()
                 nam = self.sql.getRec("rcatnm",
                                       cols=["rtn_name"],
                                       where=[("rtn_cono", "=",
                                               self.opts["conum"]),
                                              ("rtn_owner", "=", own),
                                              ("rtn_code", "=", cod),
                                              ("rtn_acno", "=", acc)],
                                       limit=1)
                 if not nam:
                     continue
                 data.append([
                     own, cod, acc, nam[0], dat[4],
                     CCD(dat[3], "d1", 10).disp, dat[6],
                     CCD(dat[7], "d1", 10).disp, d
                 ])
             else:
                 data.append(["", "", "", "", "", "", "", "", d])
     p.closeProgress()
     if not p.quit:
         name = self.__class__.__name__
         head = ["Rental's Masterfile Notes Listing"]
         cols = [["a", "NA", 7, "Own-Cod", "y"],
                 ["b", "NA", 7, "Prm-Cod", "y"],
                 ["c", "NA", 7, "Acc-Num", "y"],
                 ["d", "NA", 30, "Acc-Name", "y"],
                 ["e", "NA", 20, "User-Name", "y"],
                 ["f", "NA", 10, "Cap-Date", "y"], ["g", "UA", 1, "F", "y"],
                 ["h", "NA", 10, "Act-Date", "y"],
                 ["i", "NA", 50, "Details", "y"]]
         RepPrt(self.opts["mf"],
                conum=self.opts["conum"],
                conam=self.opts["conam"],
                name=name,
                tables=data,
                heads=head,
                cols=cols,
                ttype="D",
                repprt=self.notes.df.repprt,
                repeml=self.notes.df.repeml,
                fromad=self.fromad)
Пример #25
0
 def doTopEnd(self):
     if self.acttyp == "N":
         # Get and Display Next Document Number
         ordno = self.sql.getRec("strpom",
                                 cols=["max(pom_ordno)"],
                                 where=[("pom_cono", "=",
                                         self.opts["conum"])],
                                 limit=1)
         if not ordno[0]:
             self.ordno = CCD(1, "UI", 9).work
             self.othno = CCD(1, "Na", 9).work
         else:
             self.ordno = CCD((int(ordno[0]) + 1), "UI", 9).work
             self.othno = CCD((int(ordno[0]) + 1), "Na", 9).work
         self.df.loadEntry(self.df.frt, self.df.pag, 1, data=self.ordno)
         # Create Document Transaction (Head)
         self.dad1, self.dad2, self.dad3, self.dad4 = "", "", "", ""
         data = [
             self.opts["conum"], self.ordno, self.loc, self.trdt, self.acno,
             self.dad1, self.dad2, self.dad3, self.dad4, "", "", "", "",
             self.ordby, "", "", 0, self.opts["capnm"], self.sysdtw
         ]
         # Write and Commit Header
         self.sql.insRec("strpom", data=data)
         self.opts["mf"].dbm.commitDbase()
         # Clear Totals
         self.doClearTots()
     elif self.acttyp == "C":
         self.doReadLoadStr()
         ok = askQuestion(self.opts["mf"].body,
                          "Cancel",
                          "Are You Sure This Order Must be Cancelled?",
                          default="no")
         if ok == "yes":
             # Print Cancellation
             self.df.setWidget(self.df.mstFrame, state="hide")
             PrintOrder(self.opts["mf"],
                        self.opts["conum"],
                        self.opts["conam"],
                        self.ordno,
                        tname=self.tname,
                        repprt=self.pr.repprt,
                        repeml=self.pr.repeml,
                        copy=self.acttyp.lower())
             self.df.setWidget(self.df.mstFrame, state="show")
             # Update Deletetion
             self.sql.updRec("strpom",
                             cols=["pom_delno"],
                             data=["cancel"],
                             where=[("pom_cono", "=", self.opts["conum"]),
                                    ("pom_ordno", "=", self.ordno)])
             self.opts["mf"].dbm.commitDbase()
         # Clear totals and focus
         self.doClearTots()
         self.df.focusField("T", 0, 1)
     else:
         self.doReadLoadStr()
         self.amend = False
Пример #26
0
 def accountTotal(self):
     j = CCD(self.ctots[0], "SD", 13.2)
     k = CCD(self.ctots[1], "SD", 13.2)
     l = CCD(self.ctots[2], "SD", 13.2)
     self.fpdf.drawText()
     self.fpdf.drawText("%-34s %-13s %13s %13s" % \
         ("Account Totals", j.disp, k.disp, l.disp))
     self.ctots = [0, 0, 0]
     self.pglin += 2
Пример #27
0
 def doLoan(self, frt, pag, r, c, p, i, w):
     lmc = self.sql.waglmf_col
     rec = self.sql.getRec("waglmf", where=[("wlm_cono", "=",
         self.opts["conum"]), ("wlm_empno", "=", self.empno),
         ("wlm_loan", "=", w)], limit=1)
     if not rec:
         return "Invalid Loan Number"
     self.loan = w
     self.desc = rec[lmc.index("wlm_desc")]
     self.df.loadEntry("T", pag, p+1, data=self.desc)
     self.df.loadEntry("T", 1, 0, data=rec[lmc.index("wlm_code")])
     self.df.loadEntry("T", 1, 1, data=rec[lmc.index("wlm_rate")])
     self.df.loadEntry("T", 1, 2, data=rec[lmc.index("wlm_start")])
     self.df.loadEntry("T", 1, 3, data=rec[lmc.index("wlm_repay")])
     # Raise Interest
     LoanInterest("S", self.opts["mf"].dbm, rec, update="Y",
         curdt=int(self.sysdtw / 100), tdate=self.sysdtw, refno="Pending")
     # Get Balances
     self.lon = 0.0
     self.imt = 0.0
     self.pay = 0.0
     self.adj = 0.0
     self.bal = 0.0
     self.idt = 0
     self.pdt = 0
     whr = [
         ("wlt_cono", "=", self.opts["conum"]),
         ("wlt_empno", "=", self.empno),
         ("wlt_loan", "=", self.loan)]
     odr = "wlt_trdt, wlt_type"
     self.wlt = self.sql.getRec("wagltf", where=whr, order=odr)
     if self.wlt:
         col = self.sql.wagltf_col
         for rec in self.wlt:
             dat = CCD(rec[col.index("wlt_trdt")], "d1", 10)
             typ = CCD(rec[col.index("wlt_type")], "UI",  2)
             amt = CCD(rec[col.index("wlt_amt")], "SD",13.2)
             self.bal = float(ASD(self.bal) + ASD(amt.work))
             if typ.work == 1:
                 self.idt = dat.work
                 self.imt = float(ASD(self.imt) + ASD(amt.work))
             elif typ.work in (2, 3):
                 self.lon = float(ASD(self.lon) + ASD(amt.work))
             elif typ.work == 4:
                 self.pay = float(ASD(self.pay) + ASD(amt.work))
                 self.pdt = dat.work
             elif typ.work == 5:
                 self.adj = float(ASD(self.adj) + ASD(amt.work))
     # Load Balances
     self.df.loadEntry("T", 1, 4, data=self.lon)
     self.df.loadEntry("T", 1, 5, data=self.imt)
     self.df.loadEntry("T", 1, 6, data=self.pay)
     self.df.loadEntry("T", 1, 7, data=self.adj)
     self.df.loadEntry("T", 1, 8, data=self.bal)
     self.df.loadEntry("T", 1, 9, data=self.idt)
     self.df.loadEntry("T", 1, 10, data=self.pdt)
     self.opts["mf"].updateStatus("")
Пример #28
0
 def grandTotal(self):
     j = CCD(self.gtots[0], "SI", 7)
     k = CCD(self.gtots[1], "SD", 13.2)
     l = CCD(self.gtots[2], "SD", 13.2)
     m = CCD(self.gtots[3], "SD", 13.2)
     self.fpdf.drawText()
     self.fpdf.drawText("%-57s %7s %13s %13s %13s" %
                        ("Grand Totals", j.disp, k.disp, l.disp, m.disp))
     self.fpdf.drawText()
Пример #29
0
 def loadBalances(self, wlt):
     self.obal = 0.0
     self.cbal = 0.0
     for x, w in enumerate(wlt):
         dat = CCD(w[0], "d1", 10)
         amt = CCD(w[5], "SD", 13.2)
         if self.fdate and dat.work < self.fdate:
             self.obal = float(ASD(self.obal) + ASD(float(amt.work)))
         if dat.work <= self.ldate:
             self.cbal = float(ASD(self.cbal) + ASD(float(amt.work)))
Пример #30
0
 def grandTotal(self):
     j = CCD(self.gtots[0], "SD", 13.2)
     k = CCD(self.gtots[1], "SD", 13.2)
     l = CCD(self.gtots[2], "SD", 13.2)
     m = CCD(self.gtots[3], "SD", 13.2)
     n = CCD(self.gtots[4], "SD", 13.2)
     self.fpdf.drawText()
     self.fpdf.drawText("%-42s %13s %13s %13s %13s %13s" % \
         ("Grand Totals", j.disp, k.disp, l.disp, m.disp, n.disp))
     self.fpdf.drawText()