|
@@ -571,73 +571,74 @@ function report_sale_resumen_dna(reporting){
|
|
|
var AccountJournal = self.AccountJournal;
|
|
|
_.each(AccountJournal,function(item) {
|
|
|
|
|
|
- var total_price = 0;
|
|
|
- var price_unit = 0;
|
|
|
-
|
|
|
- var payment_type = '';
|
|
|
-
|
|
|
- var AccountInvoice = self.getAccountInvoice(item.id);
|
|
|
- _.each(AccountInvoice,function(item2) {
|
|
|
- var total_sale = 0;
|
|
|
- var partner= self.getResPartner(item2.partner_id[0]);
|
|
|
- var AccountInvoiceLine = self.getAccountInvoiceLine(item2.id);
|
|
|
- _.each(AccountInvoiceLine, function(line_item){
|
|
|
-
|
|
|
- if(item2.type == 'out_invoice'){
|
|
|
- if(line_item.product_id.standard_price >= 0){
|
|
|
+ var total_price = 0;
|
|
|
+ var price_unit = 0;
|
|
|
+
|
|
|
+ var payment_type = '';
|
|
|
+
|
|
|
+ var AccountInvoice = self.getAccountInvoice(item.id);
|
|
|
+ _.each(AccountInvoice,function(item2) {
|
|
|
+ var total_sale = 0;
|
|
|
+ var partner= self.getResPartner(item2.partner_id[0]);
|
|
|
+ var AccountInvoiceLine = self.getAccountInvoiceLine(item2.id);
|
|
|
+ _.each(AccountInvoiceLine, function(line_item){
|
|
|
+ if(item2.is_anticipo == false){
|
|
|
+ if(item2.type == 'out_invoice'){
|
|
|
+ if(line_item.product_id.standard_price >= 0){
|
|
|
+ total_sale = (line_item.price_unit);
|
|
|
+ total_price = total_sale * line_item.quantity;
|
|
|
+ }else{
|
|
|
+ price_unit = 0;
|
|
|
total_sale = (line_item.price_unit);
|
|
|
total_price = total_sale * line_item.quantity;
|
|
|
- }else{
|
|
|
- price_unit = 0;
|
|
|
- total_sale = (line_item.price_unit);
|
|
|
- total_price = total_sale * line_item.quantity;
|
|
|
- }
|
|
|
- }
|
|
|
- if(item2.type == 'out_refund'){
|
|
|
- if(line_item.product_id.standard_price >= 0){
|
|
|
- total_sale = (line_item.price_unit);
|
|
|
- total_price = -(total_sale * line_item.quantity);
|
|
|
- }else{
|
|
|
- total_sale = (line_item.price_unit);
|
|
|
- total_price = -(total_sale * line_item.quantity);
|
|
|
- }
|
|
|
- }
|
|
|
- data.push({
|
|
|
- //IDS
|
|
|
- id: line_item.id,
|
|
|
- product_id : line_item.product_id.id,
|
|
|
- invoice_id : item2.id,
|
|
|
-
|
|
|
- //DATAS
|
|
|
- product_brand_id : self.valorNull(line_item.product_id.product_brand_id),
|
|
|
- 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: item2.supplier_invoice_number,
|
|
|
- product_code : self.valorNull(line_item.product_id.default_code),
|
|
|
- barcode : self.valorNull(line_item.product_id.ean13),
|
|
|
- product_name : line_item.product_id.name,
|
|
|
- item_price : accounting.formatMoney(total_sale,'', CurrencyBase.decimal_places, CurrencyBase.thousands_separator, CurrencyBase.decimal_separator),
|
|
|
- qty : line_item.quantity,
|
|
|
- total_price : accounting.formatMoney(total_price,'', CurrencyBase.decimal_places, CurrencyBase.thousands_separator, CurrencyBase.decimal_separator),
|
|
|
- user_id : self.valorNull(item2.user_id[0]),
|
|
|
- user_name : item2.user_id[1],
|
|
|
-
|
|
|
- //VALORES SIN FORMATEAR
|
|
|
- item_price_no_format : total_sale,
|
|
|
- total_price_no_format : total_price,
|
|
|
-
|
|
|
- //TOTAL FOOTER CONFIGURATION
|
|
|
- decimal_places : CurrencyBase.decimal_places,
|
|
|
- thousands_separator: CurrencyBase.thousands_separator,
|
|
|
- decimal_separator: CurrencyBase.decimal_separator,
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(item2.type == 'out_refund'){
|
|
|
+ if(line_item.product_id.standard_price >= 0){
|
|
|
+ total_sale = (line_item.price_unit);
|
|
|
+ total_price = -(total_sale * line_item.quantity);
|
|
|
+ }else{
|
|
|
+ total_sale = (line_item.price_unit);
|
|
|
+ total_price = -(total_sale * line_item.quantity);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ data.push({
|
|
|
+ //IDS
|
|
|
+ id: line_item.id,
|
|
|
+ product_id : line_item.product_id.id,
|
|
|
+ invoice_id : item2.id,
|
|
|
+
|
|
|
+ //DATAS
|
|
|
+ product_brand_id : self.valorNull(line_item.product_id.product_brand_id),
|
|
|
+ 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),
|
|
|
+ product_code : self.valorNull(line_item.product_id.default_code),
|
|
|
+ barcode : self.valorNull(line_item.product_id.ean13),
|
|
|
+ product_name : line_item.product_id.name,
|
|
|
+ item_price : accounting.formatMoney(total_sale,'', CurrencyBase.decimal_places, CurrencyBase.thousands_separator, CurrencyBase.decimal_separator),
|
|
|
+ qty : line_item.quantity,
|
|
|
+ total_price : accounting.formatMoney(total_price,'', CurrencyBase.decimal_places, CurrencyBase.thousands_separator, CurrencyBase.decimal_separator),
|
|
|
+ user_id : self.valorNull(item2.user_id[0]),
|
|
|
+ user_name : item2.user_id[1],
|
|
|
+
|
|
|
+ //VALORES SIN FORMATEAR
|
|
|
+ item_price_no_format : total_sale,
|
|
|
+ total_price_no_format : total_price,
|
|
|
+
|
|
|
+ //TOTAL FOOTER CONFIGURATION
|
|
|
+ decimal_places : CurrencyBase.decimal_places,
|
|
|
+ thousands_separator: CurrencyBase.thousands_separator,
|
|
|
+ decimal_separator: CurrencyBase.decimal_separator,
|
|
|
|
|
|
- });
|
|
|
- });
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
});
|
|
|
});
|
|
|
|