Selaa lähdekoodia

Retocar informe de comisión de nandetv y flashnet

SEBAS 1 vuosi sitten
vanhempi
commit
a3eab00903
1 muutettua tiedostoa jossa 29 lisäystä ja 14 poistoa
  1. 29 14
      static/src/js/reports/report_customer_payment.js

+ 29 - 14
static/src/js/reports/report_customer_payment.js

@@ -331,26 +331,41 @@ function report_customer_payment (reporting){
                 var total_comision = 0;
                 var tcomision = 0;
                 var total_sale = 0;
-                total_sale = (item.amount);
+                var product_name = "";
+                var cobrado = 0;
+                cobrado = (item.amount);
                 var AccountInvoice = self.getAccountInvoice(item.reference);
                 _.each(AccountInvoice,function(item2) {
+
                     var AccountInvoiceLine = self.getAccountInvoiceLine(item2.id);
                       _.each(AccountInvoiceLine, function(line_item){
-
                         if(item2.type == 'out_invoice'){
-                            total_comision = line_item.product_id.comision_vendedor;
-
-                            total_price = total_sale * line_item.quantity;
-                            tcomision = (total_price*total_comision)/100;
+                                product_name = line_item.product_id.name + " " +line_item.product_id.name,
+                                total_comision = 5;
+                                // total_price = total_sale * line_item.quantity;
+                                // tcomision = (total_price*total_comision)/100;
                         }
                         if(item2.type == 'out_refund'){
-                          total_comision = line_item.product_id.comision_vendedor;
-                
-                          total_price = -(total_sale * line_item.quantity);
-                          tcomision = - ((total_price*total_comision)/100);
+                          product_name = line_item.product_id.name + " " +line_item.product_id.name,
+                          total_comision = 5;
+                          // total_price = -(total_sale * line_item.quantity);
+                          // tcomision = - ((total_price*total_comision)/100);
                         }
 
-                        //invoice = self.getAccountInvoice(item.reference).shift();
+                      });
+
+
+                      if(item2.type == 'out_invoice'){
+
+
+                              tcomision = (cobrado *total_comision)/100;
+                      }
+                      if(item2.type == 'out_refund'){
+
+                         tcomision = - ((cobrado *total_comision)/100);
+                      }
+
+
                         data.push({
                             id : item.id,
                             reference: item.reference,
@@ -359,8 +374,8 @@ function report_customer_payment (reporting){
                             journal: item.journal_id[1],
                             date_voucher: moment(item.date).format('YYYY-MM-DD'),
                             partner: item.partner_id[1],
-                            product_name : line_item.product_id.name,
-                            amount_in: accounting.formatMoney(total_price,'', CurrencyBase.decimal_places, CurrencyBase.thousands_separator, CurrencyBase.decimal_separator),
+                            product_name : product_name,
+                            amount_in: accounting.formatMoney(cobrado,'', CurrencyBase.decimal_places, CurrencyBase.thousands_separator, CurrencyBase.decimal_separator),
                             total_comision: accounting.formatMoney(tcomision,'', CurrencyBase.decimal_places, CurrencyBase.thousands_separator, CurrencyBase.decimal_separator),
                             date: item.date,
                             empl_name: self.valorNull(item.employee_id),
@@ -376,7 +391,7 @@ function report_customer_payment (reporting){
                             thousands_separator: CurrencyBase.thousands_separator,
                             decimal_separator: CurrencyBase.decimal_separator,
                         });
-                    });
+
               });
             });
             self.content = data;