Untitled

 avatar
unknown
plain_text
2 years ago
2.4 kB
3
Indexable
                if "0063_service" in data and data['0063_service'] !=" ":
                    row += 1 
                    transtbl = p.add_table_cell(transtbl, 1, row,  " ", self.options['trans_left3'] +  "");                 
                    row += 1     
                    transtbl = p.add_table_cell(transtbl, 1, row, " " + 'Service fees', self.options['trans_left_tbl_headings2'] + "");
                    #total = self.safe_sum(data,'0063_service') + self.safe_sum(data,'0060_service')
                    total = sum([float(item['amount_fmt']) for item in data['0063_service']]) +sum([float(item['amount_fmt']) for item in data['0060_service']]) 
                    if total < 0 :
                        display_total = "{:,.2f}".format(abs(total))
                        transtbl = p.add_table_cell(transtbl, 5, row,  "R" + display_total + " - ",  self.options['trans_left_tbl_headings4'] +  "");
                    else:
                        display_total = "{:,.2f}".format(total)
                        transtbl = p.add_table_cell(transtbl, 5, row,  "R" + display_total + "   ",  self.options['trans_left_tbl_headings4'] +  "");
                    #transtbl = p.add_table_cell(transtbl, 5, row, "R"+str(total) + " ", self.options['trans_left_tbl_headings4'] + "");

                    row += 1
                    transtbl = p.add_table_cell(transtbl, 1, row, "   Service/No", self.options[ 'trans_left2_italic'] + "");
                    transtbl = p.add_table_cell(transtbl, 2, row, ""+"Quantity/Description", self.options['trans_left_it'] + "");
                    transtbl = p.add_table_cell(transtbl, 3, row, ""+"Ref/Date"+"                 "+"Unit Price", self.options['trans_left_it'] + "");
                    transtbl = p.add_table_cell(transtbl, 4, row, "", self.options['trans_right_tbl_1'] +  "");
                    transtbl = p.add_table_cell(transtbl, 5, row, "", self.options['trans_right3'] +  "");  

                    table_x = 15  # Adjust the X-coordinate based on your layout
                    table_y = ph.getYfromtop(790)  # Adjust the Y-coordinate based on your layout
                    table_width = 567  # Adjust based on your layout
                    table_height = ph.getYfromtop(790) - table_y  # Corrected calculation for table_height
                    column_widths = [100, 200, 150, 0, 0]
                    row_height = 20
Editor is loading...