Ejemplo n.º 1
0
 def doPrintOption(self, opt):
     if opt == "N":
         return
     state = self.df.disableButtonsTags()
     self.df.setWidget(self.df.mstFrame, state="hide")
     if opt in ("I", "B"):
         table = "crsmst"
         whr = [
             ("crm_cono", "=", self.opts["conum"]),
             ("crm_acno", "=", self.acno)]
         rp = TabPrt(self.opts["mf"], self.opts["conum"], self.opts["conam"],
             name=self.__class__.__name__, tabs=table, where=whr,
             keys=[self.acno])
         repprt = rp.repprt
         repeml = rp.repeml
         xits = rp.xits
     else:
         repprt = None
         repeml = None
         xits = False
     if opt in ("T", "B") and not xits:
         heads = ["Creditor's Transactions",
             "Account: %s  Name: %s" % (self.acno, self.name)]
         whr = [
             ("crt_cono", "=", self.opts["conum"]),
             ("crt_acno", "=", self.acno)]
         if self.paidup == "Y":
             col, recs = getTrn(self.opts["mf"].dbm, "crs", whr=whr)
         else:
             col, recs = getTrn(self.opts["mf"].dbm, "crs",
                 dte=self.curdt, whr=whr)
         cols = []
         data = []
         dic = self.sql.crstrn_dic
         for num, rec in enumerate(recs):
             dat = []
             for nam in ["crt_ref1", "crt_trdt", "crt_type",
                     "crt_tramt", "paid", "balance", "crt_desc"]:
                 if not num:
                     if nam == "paid":
                         cols.append(["paid", "SD", 13.2, "Paid"])
                     elif nam == "balance":
                         cols.append(["balance", "SD", 13.2, "Balance"])
                     else:
                         cols.append([nam, dic[nam][2], dic[nam][3],
                             dic[nam][5]])
                 dat.append(rec[col.index(nam)])
             data.append(dat)
         if repprt:
             prtdia = False
         else:
             prtdia = (("Y","V"),("Y","N"))
         rp = RepPrt(self.opts["mf"], conum=self.opts["conum"],
             conam=self.opts["conam"], name=self.__class__.__name__,
             ttype="D", tables=data, heads=heads, cols=cols,
             trtp=["crt_type", crtrtp], prtdia=prtdia, repprt=repprt,
             repeml=repeml, fromad=self.fromad)
     self.df.setWidget(self.df.mstFrame, state="show")
     self.df.enableButtonsTags(state=state)
Ejemplo n.º 2
0
 def doPrint(self):
     state = self.df.disableButtonsTags()
     self.df.setWidget(self.df.mstFrame, state="hide")
     TabPrt(self.opts["mf"],
            self.opts["conum"],
            name=self.__class__.__name__,
            tabs="ctlmst",
            where=[("ctm_cono", "=", self.opts["conum"])])
     self.df.setWidget(self.df.mstFrame, state="show")
     self.df.enableButtonsTags(state=state)
     self.df.focusField(self.df.frt, self.df.pag, self.df.col)
Ejemplo n.º 3
0
 def doTrans2(self, frt, pag, r, c, p, i, w):
     self.paidup = w
     whr = [
         ("crt_cono", "=", self.opts["conum"]),
         ("crt_acno", "=", self.acno)]
     if self.paidup == "Y":
         col, recs = getTrn(self.opts["mf"].dbm, "crs", whr=whr)
     else:
         col, recs = getTrn(self.opts["mf"].dbm, "crs", dte=self.curdt,
             whr=whr)
     if recs:
         data = []
         for dat in recs:
             data.append([
                 dat[col.index("crt_trdt")],
                 dat[col.index("crt_curdt")],
                 dat[col.index("crt_batch")],
                 dat[col.index("crt_type")],
                 dat[col.index("crt_ref1")],
                 dat[col.index("crt_tramt")],
                 dat[col.index("paid")],
                 dat[col.index("balance")],
                 dat[col.index("crt_desc")]])
         tit = "Transactions for Account: %s - %s" % (self.acno, self.name)
         col = (
             ("crt_trdt", "Date", 10, "D1", "N"),
             ("crt_curdt", "Curr-Dt", 7, "D2", "N"),
             ("crt_batch", "Batch", 7, "Na", "N"),
             ("crt_type", "Typ", 3, ("XX", crtrtp), "N"),
             ("crt_ref1", "Reference", 9, "Na", "Y"),
             ("crt_tramt", "Amount", 13.2, "SD", "N"),
             ("alloc", "Allocated", 13.2, "SD", "N"),
             ("balan", "Balance", 13.2, "SD", "N"),
             ("crt_desc", "Details", 30, "NA", "N"))
         state = self.df.disableButtonsTags()
         while True:
             rec = SelectChoice(self.df.nb.Page4, tit, col, data)
             # Display all transaction details
             if rec.selection:
                 self.df.setWidget(self.df.mstFrame, state="hide")
                 whr = [
                     ("crt_cono", "=", self.opts["conum"]),
                     ("crt_acno", "=", self.acno),
                     ("crt_type", "=", rec.selection[4]),
                     ("crt_ref1", "=", rec.selection[5])]
                 TabPrt(self.opts["mf"], tabs="crstrn", where=whr,
                     pdia=False)
                 self.df.setWidget(self.df.mstFrame, state="show")
             else:
                 break
         self.df.enableButtonsTags(state=state)
     self.doTrans1()
Ejemplo n.º 4
0
 def doTrans2(self, frt, pag, r, c, p, i, w):
     tit = "Transactions for Item: %s %s - %s" % \
         (self.group, self.code, self.desc)
     dat, atc, col = self.getTrans(hist=w)
     if dat:
         state = self.df.disableButtonsTags()
         while True:
             rec = SelectChoice(self.df.nb.Page3, tit, atc, dat)
             if rec.selection:
                 self.df.setWidget(self.df.mstFrame, state="hide")
                 whr = [("ast_seq", "=", rec.selection[len(col)])]
                 TabPrt(self.opts["mf"],
                        tabs="asstrn",
                        where=whr,
                        pdia=False)
                 self.df.setWidget(self.df.mstFrame, state="show")
             else:
                 break
         self.df.enableButtonsTags(state=state)
     self.doTrans1()
Ejemplo n.º 5
0
 def doTrans2(self):
     tit = "Transactions for Account: %s - %s" % (self.acno, self.desc)
     gtt = ["gentrn"]
     gtc = (("glt_trdt", "", 0,
             "   Date"), ("glt_refno", "", 0, "Reference",
                          "Y"), ("glt_type", ("XX", gltrtp), 3, "Typ"),
            ("glt_batch", "", 0, "Batch"), ("glt_tramt", "", 0,
                                            "       Debit"),
            ("glt_tramt", "", 0, "      Credit"), ("balance", "SD", 13.2,
                                                   "     Balance"),
            ("glt_desc", "", 0, "Remarks"), ("glt_seq", "", 0, "Sequence"))
     mthno, acctot = self.getObal()
     if mthno.work == 0:
         d = self.opts["period"][1][0]
     else:
         d = (self.trnper * 100) + 1
     if acctot:
         if acctot < 0:
             dr = 0
             cr = acctot
         else:
             dr = acctot
             cr = 0
         data = [[d, "B/Fwd", 4, "", dr, cr, acctot, "Opening Balance", 0]]
     else:
         data = []
     trn = self.getTrans()
     if trn:
         col = self.sql.gentrn_col
         for rec in trn:
             acctot = float(ASD(acctot) + ASD(rec[col.index("glt_tramt")]))
             if rec[col.index("glt_tramt")] < 0:
                 dr = 0
                 cr = rec[col.index("glt_tramt")]
             else:
                 dr = rec[col.index("glt_tramt")]
                 cr = 0
             data.append([
                 rec[col.index("glt_trdt")], rec[col.index("glt_refno")],
                 rec[col.index("glt_type")], rec[col.index("glt_batch")],
                 dr, cr, acctot, rec[col.index("glt_desc")],
                 rec[col.index("glt_seq")]
             ])
     state = self.df.disableButtonsTags()
     while True:
         rec = SRec(self.opts["mf"],
                    screen=self.df.nb.Page2,
                    title=tit,
                    tables=gtt,
                    cols=gtc,
                    where=data,
                    wtype="D",
                    sort=False)
         # Display all transaction details
         if rec.selection:
             self.df.setWidget(self.df.mstFrame, state="hide")
             whr = [("glt_seq", "=", rec.selection[8])]
             TabPrt(self.opts["mf"], tabs="gentrn", where=whr, pdia=False)
             self.df.setWidget(self.df.mstFrame, state="show")
         else:
             break
     self.df.enableButtonsTags(state=state)
     self.doTrans1()
Ejemplo n.º 6
0
 def doPrintOption(self, opt):
     if opt == "N":
         return
     state = self.df.disableButtonsTags()
     self.df.setWidget(self.df.mstFrame, state="hide")
     if opt == "I":
         head = "Stores Masterfile Record"
         tab = ["strmf1", "strmf2"]
         col = [
             "st1_group", "st1_code", "st2_loc", "st1_desc", "st1_type",
             "st1_uoi", "st1_value_ind", "st1_vatcode", "st1_chn_excl",
             "st1_acc_excl", "st1_sls", "st1_cos", "st2_bin",
             "st2_reord_ind", "st2_reord_level", "st2_reord_qty"
         ]
         whr = [("st1_cono", "=", self.opts["conum"]),
                ("st1_group", "=", self.group),
                ("st1_code", "=", self.code), ("st2_cono=st1_cono", ),
                ("st2_group=st1_group", ), ("st2_code=st1_code", ),
                ("st2_loc", "=", self.loc)]
         TabPrt(self.opts["mf"],
                self.opts["conum"],
                self.opts["conam"],
                name=self.__class__.__name__,
                head=head,
                tabs=tab,
                cols=col,
                where=whr,
                keys=[self.group, self.code, self.loc])
     elif opt == "T":
         tab = ["strtrn"]
         hds = [
             "Stores's Transactions",
             "Location: %s  Group: %s  Code: %s  Description: %s" %
             (self.loc, self.group, self.code, self.desc)
         ]
         col = []
         dic = self.sql.strtrn_dic
         for c in [
                 "stt_ref1", "stt_trdt", "stt_type", "stt_qty", "stt_cost",
                 "stt_sell", "stt_desc"
         ]:
             col.append([c, dic[c][2], dic[c][3], dic[c][5]])
         whr = [("stt_cono", "=", self.opts["conum"]),
                ("stt_group", "=", self.group),
                ("stt_code", "=", self.code), ("stt_loc", "=", self.loc)]
         if self.per_from:
             whr.extend([("stt_curdt", ">=", self.per_from),
                         ("stt_curdt", "<=", self.per_to)])
         odr = "stt_trdt, stt_ref1"
         gtots = ["stt_qty", "stt_cost", "stt_sell"]
         RepPrt(self.opts["mf"],
                conum=self.opts["conum"],
                conam=self.opts["conam"],
                name=self.__class__.__name__,
                tables=tab,
                heads=hds,
                cols=col,
                where=whr,
                order=odr,
                gtots=gtots,
                prtdia=(("Y", "V"), ("Y", "N")))
     else:
         self.rcp = self.getRecipeItems()
         hds = [
             "Stores's Recipe",
             "Location: %s  Code: %s  Description: %s" %
             (self.loc, self.code, self.desc)
         ]
         RepPrt(self.opts["mf"],
                conum=self.opts["conum"],
                conam=self.opts["conam"],
                name=self.__class__.__name__,
                heads=hds,
                cols=self.rcp[0],
                tables=self.rcp[1],
                ttype="D",
                prtdia=(("Y", "V"), ("Y", "N")))
     self.df.setWidget(self.df.mstFrame, state="show")
     self.df.enableButtonsTags(state=state)
Ejemplo n.º 7
0
 def doTrans2c(self):
     tit = "Transactions for Item: %s %s - %s" % \
         (self.group, self.code, self.desc)
     tab = ["strtrn"]
     crt = (("stt_trdt", "", 0, "   Date"), ("stt_batch", "", 0, "Batch"),
            ("stt_type", "NA", 3,
             "Typ"), ("stt_ref1", "", 0, "Reference",
                      "Y"), ("stt_ref2", "", 0,
                             "Ref-Num-2"), ("stt_qty", "", 0, "  Quantity"),
            ("stt_cost", "", 0, "      Cost"), ("stt_sell", "", 0,
                                                "   Selling"),
            ("qbal", "SD", 13.2,
             "   Qty-Bal"), ("cbal", "SD", 13.2,
                             "  Cost-Bal"), ("stt_desc", "", 0, "Details"))
     whr = [("stt_cono", "=", self.opts["conum"]),
            ("stt_group", "=", self.group), ("stt_code", "=", self.code),
            ("stt_loc", "=", self.loc)]
     if self.per_from:
         whr.extend([("stt_curdt", ">=", self.per_from),
                     ("stt_curdt", "<=", self.per_to)])
     odr = "stt_trdt, stt_qty desc"
     recs = self.sql.getRec("strtrn",
                            cols=[
                                "stt_trdt", "stt_batch", "stt_type",
                                "stt_ref1", "stt_ref2", "stt_qty",
                                "stt_cost", "stt_sell", "stt_desc"
                            ],
                            where=whr,
                            order=odr)
     data = []
     tqty = 0
     tcst = 0
     for rec in recs:
         rec[2] = sttrtp[rec[2] - 1][0]
         tqty = float(ASD(tqty) + ASD(rec[5]))
         tcst = float(ASD(tcst) + ASD(rec[6]))
         rec.insert(8, tqty)
         rec.insert(9, tcst)
         data.append(rec)
     state = self.df.disableButtonsTags()
     while True:
         rec = SRec(self.opts["mf"],
                    screen=self.df.nb.Page4,
                    title=tit,
                    tables=tab,
                    cols=crt,
                    where=data,
                    wtype="D")
         if rec.selection:
             for n, t in enumerate(sttrtp):
                 if t[0] == rec.selection[2]:
                     typ = n + 1
                     break
             dte = rec.selection[0]
             doc = rec.selection[3]
             if self.itype == "R" and typ in (7, 8):
                 bt = (("Transaction", "T"), ("Recipe", "R"))
                 ask = askChoice(
                     self.df.window,
                     head="Details",
                     mess="Transaction Details or the Recipe Details",
                     butt=bt,
                     default="Transaction")
             else:
                 ask = "T"
             if ask == "T":
                 wher = [("stt_cono", "=", self.opts["conum"]),
                         ("stt_group", "=", self.group),
                         ("stt_code", "=", self.code),
                         ("stt_loc", "=", self.loc), ("stt_type", "=", typ),
                         ("stt_trdt", "=", dte), ("stt_ref1", "=", doc)]
                 TabPrt(self.opts["mf"],
                        tabs="strtrn",
                        where=wher,
                        pdia=False)
             elif typ == 7:
                 rct = "Recipe Details"
                 rcc = (("si3_line", "", 0, ""), ("si3_rgroup", "", 0, ""),
                        ("si3_rcode", "", 0, ""), ("st1_desc", "", 0, ""),
                        ("si3_rqty", "", 0, ""), ("si3_cost", "", 0, ""))
                 rcw = (("si3_cono", "=", self.opts["conum"]),
                        ("si3_rtn", "=", "I"), ("si3_docno", "=", doc),
                        ("st1_cono=si3_cono", ), ("st1_group=si3_rgroup", ),
                        ("st1_code=si3_rcode", ))
                 rco = "si3_line"
                 SRec(self.opts["mf"],
                      title=rct,
                      tables=["slsiv3", "strmf1"],
                      cols=rcc,
                      where=rcw,
                      order=rco)
             else:
                 rct = "Recipe Details"
                 rcc = (("prp_rowno", "", 0, ""), ("prp_rgroup", "", 0, ""),
                        ("prp_rcode", "", 0, ""), ("st1_desc", "", 0, ""),
                        ("prp_rqty", "", 0, ""), ("prp_cost", "", 0, ""))
                 rcw = (("prp_cono", "=", self.opts["conum"]), ("prp_docno",
                                                                "=", doc),
                        ("st1_cono=prp_cono", ), ("st1_group=prp_rgroup", ),
                        ("st1_code=prp_rcode", ))
                 rco = "prp_rowno"
                 SRec(self.opts["mf"],
                      title=rct,
                      tables=["posrcp", "strmf1"],
                      cols=rcc,
                      where=rcw,
                      order=rco)
         else:
             break
     self.df.enableButtonsTags(state=state)
     self.df.focusField("T", 4, 1)
Ejemplo n.º 8
0
 def doTrans2(self, frt, pag, r, c, p, i, w):
     self.paidup = w
     whr = [("drt_cono", "=", self.opts["conum"]),
            ("drt_chain", "=", self.chain), ("drt_acno", "=", self.acno)]
     if self.paidup == "Y":
         col, recs = getTrn(self.opts["mf"].dbm, "drs", whr=whr)
     else:
         col, recs = getTrn(self.opts["mf"].dbm,
                            "drs",
                            dte=self.curdt,
                            whr=whr)
     if recs:
         data = []
         for dat in recs:
             data.append([
                 dat[col.index("drt_trdt")], dat[col.index("drt_curdt")],
                 dat[col.index("drt_batch")], dat[col.index("drt_type")],
                 dat[col.index("drt_ref1")],
                 self.getRef2(col, dat), dat[col.index("drt_tramt")],
                 dat[col.index("paid")], dat[col.index("balance")],
                 dat[col.index("drt_desc")]
             ])
         if self.chains == "Y":
             tit = "Transactions for Account: %s %s - %s" % \
                 (self.chain, self.acno, self.name)
         else:
             tit = "Transactions for Account: %s - %s" % \
                 (self.acno, self.name)
         col = (("drt_trdt", "   Date", 10, "D1",
                 "N"), ("drt_curdt", "Curr-Dt", 7, "D2",
                        "N"), ("drt_batch", "Batch", 7, "Na", "N"),
                ("drt_type", "Typ", 3, ("XX", drtrtp),
                 "N"), ("drt_ref1", "Reference", 9, "Na",
                        "Y"), ("drt_ref2", "Ref-Number-Two", 14, "Na", "Y"),
                ("drt_tramt", "    Amount", 13.2, "SD",
                 "N"), ("alloc", " Allocated", 13.2, "SD",
                        "N"), ("balan", "   Balance", 13.2, "SD",
                               "N"), ("drt_desc", "Details", 30, "NA", "N"))
         state = self.df.disableButtonsTags()
         while True:
             rec = SelectChoice(self.df.nb.Page5, tit, col, data)
             # If Invoice or Credit Note, attempt to display the document
             # else display all transaction details
             if rec.selection:
                 self.df.setWidget(self.df.mstFrame, state="hide")
                 if rec.selection[4] in (1, 4):
                     if rec.selection[4] == 1:
                         typ = "I"
                     else:
                         typ = "C"
                     try:
                         doc = int(rec.selection[5])
                         inv = self.sql.getRec("slsiv1",
                                               where=[("si1_cono", "=",
                                                       self.opts["conum"]),
                                                      ("si1_rtn", "=", typ),
                                                      ("si1_docno", "=",
                                                       doc)],
                                               limit=1)
                     except:
                         inv = []
                 else:
                     inv = []
                 if inv:
                     PrintInvoice(self.opts["mf"],
                                  self.opts["conum"],
                                  self.opts["conam"],
                                  typ,
                                  doc,
                                  repprt=["N", "V", "view"],
                                  copy="y")
                 else:
                     whr = [("drt_cono", "=", self.opts["conum"]),
                            ("drt_chain", "=", self.chain),
                            ("drt_acno", "=", self.acno),
                            ("drt_type", "=", rec.selection[4]),
                            ("drt_ref1", "=", rec.selection[5])]
                     TabPrt(self.opts["mf"],
                            tabs="drstrn",
                            where=whr,
                            pdia=False)
                 self.df.setWidget(self.df.mstFrame, state="show")
             else:
                 break
         self.df.enableButtonsTags(state=state)
     self.doTrans1()
Ejemplo n.º 9
0
 def doPrint(self):
     titl = "Select the Required Print Options"
     cols = (("a", "C", 1, "UA", "N"), ("b", "Description", 30, "NA", "N"))
     if self.df.last[0][0] != 1:
         data = [("A", "Print Card")]
     else:
         data = []
     data.extend([("B", "Print Directory"), ("C", "Print Contacts"),
                  ("D", "Print Notes")])
     ss = SelectChoice(self.df.mstFrame, titl, cols, data, sort=False)
     self.opts["mf"].updateStatus("")
     if not ss.selection:
         self.df.focusField(self.df.frt, self.df.pag, self.df.col)
         return
     state = self.df.disableButtonsTags()
     self.df.setWidget(self.df.mstFrame, state="hide")
     if ss.selection[1] == "A":
         head = ["Card for %s" % self.name]
         whr = [("tdm_name", "=", self.name)]
         TabPrt(self.opts["mf"],
                name=self.__class__.__name__,
                tabs="telmst",
                head=head,
                where=whr)
     elif ss.selection[1] == "D":
         self.notes = NotesPrint(self.opts["mf"], 0, "", "TEL", loop=False)
         if not self.notes.data:
             pass
         else:
             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
                 desc = textFormat(dat[5], width=50)
                 for n, d in enumerate(desc):
                     if not n:
                         data.append([
                             dat[2], 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 = ["Telephone Directory Notes Listing"]
                 cols = [["a", "NA", 30, "Name", "y"],
                         ["b", "NA", 20, "User-Name", "y"],
                         ["c", "NA", 10, "Cap-Date", "y"],
                         ["d", "UA", 1, "F", "y"],
                         ["e", "NA", 10, "Act-Date", "y"],
                         ["f", "NA", 50, "Details", "y"]]
                 RepPrt(self.opts["mf"],
                        name=name,
                        tables=data,
                        heads=head,
                        cols=cols,
                        ttype="D",
                        repprt=self.notes.df.repprt,
                        repeml=self.notes.df.repeml)
     else:
         tit = ["Telephone Directory"]
         grp = {
             "stype":
             "R",
             "tables": ("telgrp", ),
             "cols": (("tdg_group", "UA", 3, "Grp"), ("tdg_desc", "NA", 30,
                                                      "Description")),
             "order":
             "tdg_desc"
         }
         fld = ((("T", 0, 0, 0), "IUA", 3, "Group", "", "", "N", self.prGrp,
                 grp, None, ("efld", )), )
         self.pr = TartanDialog(self.opts["mf"],
                                tops=True,
                                title=tit,
                                eflds=fld,
                                tend=((self.prEnd, "y"), ),
                                txit=(self.prExit, ))
         self.pr.mstFrame.wait_window()
         if not self.prxit:
             if self.prgrp:
                 if ss.selection[1] == "B":
                     head = ["Details for Group %s" % self.prgrp]
                     whr = [("tdm_group", "=", self.prgrp)]
                 else:
                     head = ["Contacts for Group %s" % self.prgrp]
                     whr = [("tdm_group", "=", self.prgrp),
                            ("tdc_name=tdm_name", )]
             else:
                 if ss.selection[1] == "B":
                     head = ["Cards for All Groups"]
                     whr = []
                 else:
                     head = ["Contacts for All Groups"]
                     whr = []
             if ss.selection[1] == "B":
                 tab = ["telmst"]
                 col = [
                     "tdm_name", "tdm_telno", "tdm_faxno", "tdm_mobile",
                     "tdm_email"
                 ]
             else:
                 tab = ["telmst", "telcon"]
                 col = [
                     "tdm_name", "tdc_contact", "tdc_desig", "tdc_telno",
                     "tdc_celno", "tdc_email"
                 ]
             prtdia = (("Y", "V"), ("Y", "N"))
             RepPrt(self.opts["mf"],
                    name=self.__class__.__name__,
                    tables=tab,
                    heads=head,
                    cols=col,
                    where=whr,
                    order="tdm_name",
                    prtdia=prtdia)
     self.df.setWidget(self.df.mstFrame, state="show")
     self.df.enableButtonsTags(state=state)
     self.df.focusField(self.df.frt, self.df.pag, self.df.col)