Exemple #1
0
    def printLabel(self):
        print "Printing"

        self.stats.remove_widget(self.stats.labelBox)

        self.laytemp = FboFloatLayout(size_hint=(None, None),
                                      size=(6 * 96, 4 * 96))

        self.laytemp.add_widget(self.stats.labelBox)

        self.clear_widgets()

        self.add_widget(self.laytemp)

        Clock.schedule_once(self.do_save, 0)
Exemple #2
0
 def printLabel(self):
     print "Printing"
     
     self.stats.remove_widget(self.stats.labelBox)
     
     self.laytemp = FboFloatLayout(size_hint=(None,None), size=(6*96,4*96))
     
     self.laytemp.add_widget(self.stats.labelBox)
     
     self.clear_widgets()
     
     self.add_widget(self.laytemp)
     
     Clock.schedule_once(self.do_save, 0)
Exemple #3
0
class Orgboat(BoxLayout):

    menu = ObjectProperty()
    receipts = ObjectProperty()
    workSpace = ObjectProperty()

    def __init__(self, **kwargs):
        super(Orgboat, self).__init__(**kwargs)

        self.newreceipt = NewReceipt()
        self.reports = Reports()
        self.commendations = Commendations()
        self.stats = Stats()

        self.currentTab = self.receipts

    def changeTab(self, tabToShow):
        self.workSpace.remove_widget(self.currentTab)

        self.currentTab = tabToShow
        self.workSpace.add_widget(self.currentTab)

    def fillLabel(self):
        print "Getting information of the receipt: ", self.stats.receiptNum.text

        self.receipt = Receipts.Query.filter(
            ReceiptNum__in=[int(self.stats.receiptNum.text)])

        #the boxes
        self.boxes = Boxes.Query.filter(
            Receipt__in=[{
                "__type": "Pointer",
                "className": "Receipts",
                "objectId": self.receipt[0].objectId
            }])
        self.ibox = 0

        self.updateLabel()

    def updateLabel(self):
        #poner los valores en la etiqueta de impresion
        self.stats.companyName.text = self.receipt[0].Company.name
        self.stats.txt_receiptnum.text = str(self.receipt[0].ReceiptNum)
        self.stats.txt_destination.text = self.receipt[0].Destination
        self.stats.txt_shipper.text = self.receipt[0].Shipper.Name

        self.stats.txt_length.text = self.boxes[self.ibox].Length
        self.stats.txt_width.text = self.boxes[self.ibox].Width
        self.stats.txt_height.text = self.boxes[self.ibox].Height
        self.stats.txt_volume.text = self.receipt[0].Volume
        self.stats.txt_weightvol.text = self.receipt[0].WeightVol
        self.stats.txt_weight.text = self.boxes[self.ibox].Weight
        self.stats.txt_nbox.text = self.boxes[self.ibox].Num

        self.stats.txt_zone.text = self.receipt[0].Zone
        self.stats.txt_time.text = str(self.receipt[0].ReceiptDate)
        self.stats.txt_consignee.text = self.receipt[0].Consignee.Name
        self.stats.txt_madeby.text = self.receipt[0].Usr.Name

        img_qrcode = qrcode.make(self.boxes[self.ibox].objectId)
        img_qrcode.save(self.boxes[self.ibox].objectId + ".png")

        self.stats.img_qrcode.source = self.boxes[self.ibox].objectId + ".png"

    def printLabel(self):
        print "Printing"

        self.stats.remove_widget(self.stats.labelBox)

        self.laytemp = FboFloatLayout(size_hint=(None, None),
                                      size=(6 * 96, 4 * 96))

        self.laytemp.add_widget(self.stats.labelBox)

        self.clear_widgets()

        self.add_widget(self.laytemp)

        Clock.schedule_once(self.do_save, 0)

    def do_save(self, dt):

        self.laytemp.texture.save(self.boxes[self.ibox].objectId + ".png")

        Clock.schedule_once(self.next_save, 0)

    def next_save(self, dt):
        if self.ibox < len(self.boxes) - 1:
            self.ibox += 1
            self.updateLabel()
            Clock.schedule_once(self.do_save, 0)

        else:
            #create the PDF file
            c = canvas.Canvas("labels.pdf", pagesize=(6 * inch, 4 * inch))
            c.setStrokeColorRGB(0, 0, 0)
            c.setFillColorRGB(0, 0, 0)
            #c.setFont("Helvetica", 12 * point)

            for i in range(0, len(self.boxes)):
                #image
                c.drawImage(self.boxes[i].objectId + ".png", 0, 0, 6 * inch,
                            4 * inch)
                c.showPage()

            c.save()
Exemple #4
0
class Orgboat(BoxLayout):

    menu = ObjectProperty()
    receipts = ObjectProperty()
    workSpace = ObjectProperty()

    def __init__(self, **kwargs):
        super(Orgboat, self).__init__(**kwargs)
        
        self.newreceipt = NewReceipt()
        self.reports = Reports()
        self.commendations = Commendations()
        self.stats = Stats()
        
        self.currentTab = self.receipts
        
    def changeTab(self, tabToShow):
        self.workSpace.remove_widget(self.currentTab)
        
        self.currentTab = tabToShow
        self.workSpace.add_widget(self.currentTab)
        
    def fillLabel(self):
        print "Getting information of the receipt: ", self.stats.receiptNum.text
        
        self.receipt = Receipts.Query.filter(ReceiptNum__in=[int(self.stats.receiptNum.text)])
        
        #the boxes
        self.boxes = Boxes.Query.filter(Receipt__in=[{"__type":"Pointer", "className":"Receipts", "objectId":self.receipt[0].objectId}])
        self.ibox = 0
        
        self.updateLabel()
        
    def updateLabel(self):
        #poner los valores en la etiqueta de impresion
        self.stats.companyName.text = self.receipt[0].Company.name
        self.stats.txt_receiptnum.text = str(self.receipt[0].ReceiptNum)
        self.stats.txt_destination.text = self.receipt[0].Destination
        self.stats.txt_shipper.text = self.receipt[0].Shipper.Name
        
        self.stats.txt_length.text = self.boxes[self.ibox].Length
        self.stats.txt_width.text = self.boxes[self.ibox].Width
        self.stats.txt_height.text = self.boxes[self.ibox].Height
        self.stats.txt_volume.text = self.receipt[0].Volume
        self.stats.txt_weightvol.text = self.receipt[0].WeightVol
        self.stats.txt_weight.text = self.boxes[self.ibox].Weight
        self.stats.txt_nbox.text = self.boxes[self.ibox].Num
        
        self.stats.txt_zone.text = self.receipt[0].Zone
        self.stats.txt_time.text = str(self.receipt[0].ReceiptDate)
        self.stats.txt_consignee.text = self.receipt[0].Consignee.Name
        self.stats.txt_madeby.text = self.receipt[0].Usr.Name
        
        
        img_qrcode = qrcode.make(self.boxes[self.ibox].objectId)
        img_qrcode.save(self.boxes[self.ibox].objectId + ".png")
        
        self.stats.img_qrcode.source = self.boxes[self.ibox].objectId + ".png"
        
        
        
    def printLabel(self):
        print "Printing"
        
        self.stats.remove_widget(self.stats.labelBox)
        
        self.laytemp = FboFloatLayout(size_hint=(None,None), size=(6*96,4*96))
        
        self.laytemp.add_widget(self.stats.labelBox)
        
        self.clear_widgets()
        
        self.add_widget(self.laytemp)
        
        Clock.schedule_once(self.do_save, 0)
        
    def do_save(self, dt):
        
        self.laytemp.texture.save(self.boxes[self.ibox].objectId + ".png")

        Clock.schedule_once(self.next_save, 0)

    def next_save(self, dt):
        if self.ibox < len(self.boxes)-1:
            self.ibox += 1
            self.updateLabel()
            Clock.schedule_once(self.do_save, 0)
            
        else:
            #create the PDF file
            c = canvas.Canvas("labels.pdf", pagesize=(6 * inch, 4 * inch))
            c.setStrokeColorRGB(0,0,0)
            c.setFillColorRGB(0,0,0)
            #c.setFont("Helvetica", 12 * point)
            
            for i in range(0, len(self.boxes) ):                            
                #image
                c.drawImage(self.boxes[i].objectId+".png", 0, 0, 6 * inch, 4 * inch)
                c.showPage()
            
            c.save()