Przeglądaj źródła

Agregar fecha de pago y mayor saldo a 0 en informe de cuentas

root 3 lat temu
rodzic
commit
c1a71ab02d
1 zmienionych plików z 71 dodań i 69 usunięć
  1. 71 69
      static/src/js/reports/report_cuenta_resumen_dna.js

+ 71 - 69
static/src/js/reports/report_cuenta_resumen_dna.js

@@ -684,75 +684,77 @@ function report_cuenta_resumen_dna(reporting){
             // var AccountInvoice = self.getAccountInvoice(item.id);
             var AccountInvoice = self.getAccountInvoice();
             _.each(AccountInvoice,function(item2) {
-              var description_product = '';
-              var date_pay = '';
-              var date = '';
-              if(item2.is_anticipo == false){
-              var total_sale = 0;
-              var forma = 'Contado';
-               if (item2.contado == true){
-                  forma = 'Contado'
-               };
-               if (item2.credito == true){
-                  forma = 'Credito'
-               };
-               if (!item2.date_pay){
-                  date_pay = ''
-               };
-               if (item2.date_pay){
-                  date_pay = item2.date_pay
-               };
-               var voucher = self.getAccountVoucher(item2.number).shift();
-
-               if (voucher != null){
-                    date = voucher.date
-                }else{
-                      date = ''
-                }
-
-
-               var AccountInvoiceLine = self.getAccountInvoiceLine(item2.id);
-               _.each(AccountInvoiceLine, function(line_item){
-                  description_product = description_product + " " + line_item.product_id.name
-               });
-
-                    var partner= self.getResPartner(item2.partner_id[0]);
-                    var currency = self.getResCurrency(item2.company_currency[0]).shift();
-
-                      data.push({
-                        //IDS
-                        invoice_id : item2.id,
-
-                        //DATAS
-                        date_invoice: moment(item2.date_invoice).format('DD/MM/YYYY'),
-                        partner_id : item2.partner_id[0],
-                        partner_name : item2.partner_id[1],
-                        ruc: self.valorNull(item2.partner_id[2]),
-                        partner_email: self.valorNull(item2.partner_id[3]),
-                        partner_mobile: self.valorNull(item2.partner_id[4]),
-                        invoice_name : self.valorNull(item2.number),
-                        supplier_invoice_number: self.valorNull(item2.supplier_invoice_number),
-                        forma: forma,
-                        date_pay:  moment(date_pay).format('DD/MM/YYYY'),
-                        date_pago:  moment(date).format('DD/MM/YYYY'),
-                        product_name: description_product,
-                        amount_total: accounting.formatMoney(item2.amount_total_currency, '', CurrencyBase.decimal_places, CurrencyBase.thousands_separator, CurrencyBase.decimal_separator),
-                        amount_pagado:accounting.formatMoney(item2.amount_total - item2.residual,'',CurrencyBase.decimal_places,CurrencyBase.thousands_separator,CurrencyBase.decimal_separator),
-                        amount_residual: accounting.formatMoney((item2.residual * (CurrencyBase.rate_silent/currency.rate_silent)), '', CurrencyBase.decimal_places, CurrencyBase.thousands_separator, CurrencyBase.decimal_separator),
-                        date: item2.date_invoice,
-                        amount : (item2.amount_total),
-                        residual: (item2.residual),
-                        pagado: item2.amount_total - item2.residual,
-                        user_id : self.valorNull(item2.user_id[0]),
-                        user_name : item2.user_id[1],
-
-                        //TOTAL FOOTER CONFIGURATION
-                        decimal_places : CurrencyBase.decimal_places,
-                        thousands_separator: CurrencyBase.thousands_separator,
-                        decimal_separator: CurrencyBase.decimal_separator,
-
-                      });
-              }
+              if (item2.residual>0){
+                    var description_product = '';
+                    var date_pay = '';
+                    var date = '';
+                    if(item2.is_anticipo == false){
+                    var total_sale = 0;
+                    var forma = 'Contado';
+                     if (item2.contado == true){
+                        forma = 'Contado'
+                     };
+                     if (item2.credito == true){
+                        forma = 'Credito'
+                     };
+                     if (!item2.date_pay){
+                        date_pay = ''
+                     };
+                     if (item2.date_pay){
+                        date_pay = item2.date_pay
+                     };
+                     var voucher = self.getAccountVoucher(item2.number).shift();
+
+                     if (voucher != null){
+                          date = voucher.date
+                      }else{
+                            date = ''
+                      }
+
+
+                     var AccountInvoiceLine = self.getAccountInvoiceLine(item2.id);
+                     _.each(AccountInvoiceLine, function(line_item){
+                        description_product = description_product + " " + line_item.product_id.name
+                     });
+
+                          var partner= self.getResPartner(item2.partner_id[0]);
+                          var currency = self.getResCurrency(item2.company_currency[0]).shift();
+
+                            data.push({
+                              //IDS
+                              invoice_id : item2.id,
+
+                              //DATAS
+                              date_invoice: moment(item2.date_invoice).format('DD/MM/YYYY'),
+                              partner_id : item2.partner_id[0],
+                              partner_name : item2.partner_id[1],
+                              ruc: self.valorNull(item2.partner_id[2]),
+                              partner_email: self.valorNull(item2.partner_id[3]),
+                              partner_mobile: self.valorNull(item2.partner_id[4]),
+                              invoice_name : self.valorNull(item2.number),
+                              supplier_invoice_number: self.valorNull(item2.supplier_invoice_number),
+                              forma: forma,
+                              date_pay:  moment(date_pay).format('DD/MM/YYYY'),
+                              date_pago:  moment(date).format('DD/MM/YYYY'),
+                              product_name: description_product,
+                              amount_total: accounting.formatMoney(item2.amount_total_currency, '', CurrencyBase.decimal_places, CurrencyBase.thousands_separator, CurrencyBase.decimal_separator),
+                              amount_pagado:accounting.formatMoney(item2.amount_total - item2.residual,'',CurrencyBase.decimal_places,CurrencyBase.thousands_separator,CurrencyBase.decimal_separator),
+                              amount_residual: accounting.formatMoney((item2.residual * (CurrencyBase.rate_silent/currency.rate_silent)), '', CurrencyBase.decimal_places, CurrencyBase.thousands_separator, CurrencyBase.decimal_separator),
+                              date: item2.date_invoice,
+                              amount : (item2.amount_total),
+                              residual: (item2.residual),
+                              pagado: item2.amount_total - item2.residual,
+                              user_id : self.valorNull(item2.user_id[0]),
+                              user_name : item2.user_id[1],
+
+                              //TOTAL FOOTER CONFIGURATION
+                              decimal_places : CurrencyBase.decimal_places,
+                              thousands_separator: CurrencyBase.thousands_separator,
+                              decimal_separator: CurrencyBase.decimal_separator,
+
+                            });
+                         };
+                    }
 
           });