Пример #1
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)
Пример #2
0
 def doCalCost(self, grp, code, qty, chk=True):
     # Calculate cost price
     icost, tcost, bal = getCost(self.sql,
                                 self.opts["conum"],
                                 grp,
                                 code,
                                 loc=self.loc,
                                 qty=qty,
                                 tot=True,
                                 bal=True)
     if chk and qty > bal[0]:
         acc = self.sql.getRec("strmf1",
                               cols=["st1_desc"],
                               where=[("st1_cono", "=", self.opts["conum"]),
                                      ("st1_group", "=", grp),
                                      ("st1_code", "=", code)],
                               limit=1)
         cf = PwdConfirm(self.opts["mf"],
                         conum=self.opts["conum"],
                         system="STR",
                         code="ExQty",
                         product=(grp, code, acc[0]))
         if cf.flag == "no":
             return
     return tcost
Пример #3
0
 def doGetCost(self, grp, code):
     if self.costs == "N":
         ind = "I"
     else:
         ind = self.costs
     cost, bal = getCost(self.sql, self.opts["conum"], grp, code,
         loc=self.loc, ind=ind, bal=True)
     return (cost, bal[0])
Пример #4
0
 def doQty(self, frt, pag, r, c, p, i, w):
     self.qty = w
     # Last Cost Price
     lcost = getCost(self.sql,
                     self.opts["conum"],
                     self.group,
                     self.code,
                     loc=self.loc,
                     qty=1,
                     ind="L")
     self.df.loadEntry(frt, pag, p + 1, data=lcost)
Пример #5
0
 def doVat(self, frt, pag, r, c, p, i, w):
     self.vatrte = getVatRate(self.sql, self.opts["conum"], w, self.trdt)
     if self.vatrte is None:
         return "Invalid V.A.T Code"
     self.vatcod = w
     # Last Cost Price
     lcost = getCost(self.sql,
                     self.opts["conum"],
                     self.grp,
                     self.code,
                     loc=self.loc,
                     qty=1,
                     ind="L")
     self.df.loadEntry(frt, pag, p + 1, data=lcost)
Пример #6
0
 def getValues(self, data):
     grp = CCD(data[0], "UA", 3)
     self.groupd = grp.disp
     code = CCD(data[1], "NA", 20)
     desc = CCD(data[2], "UA", 30)
     uoi = CCD(data[3], "NA", 10)
     # Cost Prices and Balances
     cst, bal = getCost(self.sql,
                        self.opts["conum"],
                        grp.work,
                        code.work,
                        loc=self.loc,
                        qty=1,
                        ind="AL",
                        bal=True)
     qty = CCD(bal[0], "SD", 12.2)
     if self.nostock == "Y" and qty.work <= 0:
         return
     acst = CCD(cst[0], "SD", 10.2)
     lcst = CCD(cst[1], "SD", 10.2)
     if self.rtype == "C":
         return (grp, code, desc, uoi, qty, acst, lcst)
     # Selling Prices
     vat = CCD(data[4], "UA", 1)
     rte = 0
     if self.vatinc == "Y":
         vatrte = getVatRate(self.sql, self.opts["conum"], vat.work,
                             self.sysdtw)
         if vatrte is not None:
             rte = vatrte
     prcs = []
     for lev in self.levs:
         prc = getSell(self.sql, self.opts["conum"], grp.work, code.work,
                       self.loc, lev)
         prcs.append(CCD(round((prc * ((100 + rte) / 100.0)), 2), "UD",
                         9.2))
     if self.noprice == "Y":
         cont = False
         for prc in prcs:
             if prc.work:
                 cont = True
                 break
         if not cont:
             return
     return (grp, code, desc, uoi, vat, qty, acst, lcst, prcs)