Example #1
0
 def command(self):
     config=load_config(self.args)
     filconadobj=FilconadObj(config,self.options.etl)        
     if self.options.store:
         filconadobj.store_files()            
     if self.options.write:
         filconadobj.write_out()
Example #2
0
File: b2b.py Project: nomed/ebetl
 def command(self):
     config=load_config(self.args)
     b2bobj=B2bObj(config)                  
     if self.options.write:
         b2bobj.write_out()
     if self.options.export:
         b2bobj.export()            
Example #3
0
    def command(self):
        config=load_config(self.args)
        if self.options.export:
            f = open(config.get('starlogic.out'),'w')
            fs = open(config.get('starlogic.sincro'))
            sincro = 0
            for i in  fs.readlines():
                sincro = i.strip()
                sincro = int(sincro)
            fs.close()
            ps = DBSession.query(Eanprodotti)
            if not self.options.all:
                ps = ps.filter(Eanprodotti.sincrofield>sincro)
            ps = ps.order_by(Eanprodotti.sincrofield).all()

            for p in ps:
                codart = p.prodotto.eans[0].ean
                desc = p.prodotto.prodotto.encode('ascii', 'ignore')
                prezzo = p.prodotto.prezzo            
                sincro = p.sincrofield
                print >> f, "%s;%s;%s;%s;%s"%(codart, p.ean, desc, prezzo,0)
                
                if len(p.aliases)>0:
                    for alias in p.aliases:
                        print >> f, "%s;%s;%s;%s;%s"%(codart, alias.alias, desc, prezzo,1)
            f.close()
            f = open(config.get('starlogic.sincro'),'w')
            print >>  f, sincro		        
            f.close()
Example #4
0
 def command(self):
     config = load_config(self.args)
     self.options.etl = "zucchetti"
     zucchettiobj = ZucchettiObj(config, self.options.etl)
     if self.options.store:
         zucchettiobj.store_files()
     if self.options.write:
         zucchettiobj.write_out()
Example #5
0
    def command(self):
        config=load_config(self.args)
                        
        if self.options.export:
            cfs = DBSession.query(Clientifid).filter(Clientifid.email!=' ').all()
            output = []
            for c in cfs:
			output.append('"%s %s" <%s>'%(c.nome, c.cognome, c.email))
			f = open(self.options.export, 'w')
			for o in output:
				print >> f, o.encode('utf-8')
			f.close()
Example #6
0
 def command(self):
     config=load_config(self.args)
     if self.options.export:
         mistralobj=Db2Mistral(config)
         mistralobj.write_out2()            
         mistralobj.write_out()
Example #7
0
    def command(self):
        config=load_config(self.args)
        from ebetl.lib.views import get_dailytotals,get_dailymenuitems, sync_do, sync_dmi, sync_lilliput, print_fact_dmi
        if self.options.fromd:
            fromd = dt.strptime(self.options.fromd, "%Y%m%d")
        if self.options.tod:
            tod = dt.strptime(self.options.tod, "%Y%m%d") + td(days=1)
        else:
            try:
                tod = fromd + td(days=1)
            except:
                pass
        if self.options.items:
            #(u'000351', 1, u'351 ARQUATA', 2014, 1, 2, 1, u'PANETTERIA', 17, u'PANETTERIA', 207.73120000000006, 8.308799999999996, 216.03999999999996)
            retly_tmp = get_dailymenuitems(fromd - rd(years=1), tod - rd(years=1))
            retly = []
            for r in retly_tmp:
                row = list(r)
                row[3] = row[3]+1
                retly.append(row)
            maply = get_map(retly)
            ret = get_dailymenuitems(fromd, tod)
            mapcy = get_map(ret)
            results = []
            for k in ret:
                pdv = k[0]
                y = k[3]                
                m = k[4]
                d = k[5]
                acc_num=k[6]
                rep_num=k[8]
                try:
                    ly = maply[pdv][y][m][d][acc_num][rep_num]
                    ly = ly[10:]
                    
                except:
                    ly = ["0","0","0"]
                results.append(list(k)+list(ly)) 
            for k in retly:
                pdv = k[0]
                y = k[3]                
                m = k[4]
                d = k[5]
                acc_num=k[6]
                rep_num=k[8]
                try:
                    mapcy[pdv][y][m][d][acc_num][rep_num]                    
                except:
                    results.append(k[0:10]+["0","0","0"]+k[10:])                 
            #for i in results:
            #    p = [str(j).replace('.',',') for j in i]
            #    print "|".join(p)   
            sync_dmi(results)                                                                                              

        elif not self.options.sync and not self.options.printr:    
            # (u'000297', 2013, 1, 8, 396, 14.901287878787729, 5396.611399999985, 504.2985999999985, 5900.909999999941)
            retly_tmp = get_dailytotals(fromd - rd(years=1), tod - rd(years=1))
            retly = []
            for r in retly_tmp:
                row = list(r)
                row[1] = row[1]+1
                retly.append(row)            
            maply = get_map_do(retly)
            ret = get_dailytotals(fromd, tod)
            mapcy = get_map_do(ret)
            
            results = []
            
            for k in ret:
                pdv = k[0]
                y = k[1]
                m = k[2]
                d = k[3]
                
                try:
                    ly = maply[pdv][y][m][d]
                    ly = ly[4:]
                    
                except:
                    ly = ["0","0","0","0","0"]
                results.append(list(k)+list(ly)) 
            for k in retly:
                pdv = k[0]
                y = k[1]
                m = k[2]
                d = k[3]
                try:
                    mapcy[pdv][y][m][d]           
                except:
                    results.append(k[0:4]+["0","0","0","0","0"]+k[4:])                 
            #for i in results:
            #    p = [str(j).replace('.',',') for j in i]
            #    print "|".join(p)
            sync_do(results)
            #print results                          
        if self.options.sync:
            sync_lilliput()
        if self.options.printr:
            from prettytable import PrettyTable
            ret, tot = print_fact_dmi('000351', fromd, tod)            
            print tot
            x = PrettyTable(["Famiglia", "Tot AC", "Tot AP", "Diff"])
            x.align["Famiglia"] = "l" 
            x.align["Tot"] = "r" 
            x.align["Tot AC"] = "r"             
            x.align["Tot AP"] = "r"             
            x.align["Diff"] = "r"              
            x.padding_width = 1 # One space between column edges and contents (default)
            x.float_format = '.2'
            for r in ret:
                x.add_row(r)
            for t in tot:
                t_lst = ['TOTALE'] + [i for i in t]
                x.add_row(t_lst)
                       
            print x