From acdf10d7bcfb73aeb99f11cc88ab24d390cca06f Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 28 Feb 2023 18:10:13 -0600 Subject: [PATCH] Se agregan archivos de apoyo --- Repository/Reportes.js | 50 +------ app.js | 3 - views - Copy/pages/Amazon/Invoice.ejs | 34 +++++ .../partials/Amazon/InvoiceFooter.ejs | 34 +++++ .../partials/Amazon/InvoiceHeader.ejs | 129 ++++++++++++++++++ views - Copy/partials/Amazon/Items.ejs | 38 ++++++ .../partials/Amazon/ItemsTableHeader.ejs | 14 ++ views/partials/Amazon/InvoiceFooter.ejs | 25 +++- views/partials/Amazon/InvoiceHeader.ejs | 105 ++++---------- views/partials/Amazon/Items.ejs | 7 +- 10 files changed, 302 insertions(+), 137 deletions(-) create mode 100644 views - Copy/pages/Amazon/Invoice.ejs create mode 100644 views - Copy/partials/Amazon/InvoiceFooter.ejs create mode 100644 views - Copy/partials/Amazon/InvoiceHeader.ejs create mode 100644 views - Copy/partials/Amazon/Items.ejs create mode 100644 views - Copy/partials/Amazon/ItemsTableHeader.ejs diff --git a/Repository/Reportes.js b/Repository/Reportes.js index cae2902..ab2d5e6 100644 --- a/Repository/Reportes.js +++ b/Repository/Reportes.js @@ -1,54 +1,13 @@ var config = require('../config/dbconfig') const sql = require('mssql') -async function getRptControlDocumentosClientes() { - try { - let pool = await sql.connect(config) - let reporte = await pool - .request() - .query("SELECT * FROM ReportesDocsSir WHERE Estatus='Activo'") - return reporte.recordset - } catch (error) { - console.log(error) - } -} - -async function getNoPartesAmazon(id) { - try { - let pool = await sql.connect(config) - const result = await pool - .request() - .input('id', id) - .execute(`[Clientes.Amazon.Invoice.NoPartes2Excel.Get]`) - //const NoPartesSIR = result.recordset; - console.log(result.recordset) - return result.recordset - } catch (error) { - console.log(error) - } -} - -async function getExceptionsFile4Amazon(id) { - try { - let pool = await sql.connect(config) - const result = await pool - .request() - .input('id', id) - .execute(`[Clientes.Amazon.Invoice.ExceptionsFile.Get]`) - console.log(result.recordset) - return result.recordset - } catch (error) { - console.log(error) - } -} - async function getAmazonInvoiceDetail(id) { try { let pool = await sql.connect(config) const result = await pool .request() - .input('id', id) - .query(`SELECT ItemId,ItemDescription, ItemQuantityUnitOfMeasure, CountryOfOrigin,Quantity,WeightValue, ActualUnitCostMonetaryAmount, TotalUnitValueMonetaryAmount FROM [Clientes.Amazon.Invoice.Detail] WHERE IdHeader = @id`) + .input('id', id) + .query(`SELECT ItemId, ItemDescription, ItemQuantityUnitOfMeasure, CountryOfOrigin, Quantity, Cast(((WeightValue/Quantity)* .4536) as decimal(18,4)) as WeightValue, ActualUnitCostMonetaryAmount, TotalUnitValueMonetaryAmount, AmazonShipmentReferenceId FROM [Clientes.Amazon.Invoice.Detail] WHERE IdHeader = @id AND SightLine=1 Order BY Partida`) console.log(result.recordset) return result.recordset } catch (error) { @@ -85,10 +44,7 @@ async function getAmazonInvoiceHeader(id) { } module.exports = { - getRptControlDocumentosClientes: getRptControlDocumentosClientes, - getNoPartesAmazon: getNoPartesAmazon, - getExceptionsFile4Amazon: getExceptionsFile4Amazon, - getAmazonInvoiceDetail: getAmazonInvoiceDetail, + getAmazonInvoiceDetail: getAmazonInvoiceDetail, getAmazonInvoiceShipmentInfo: getAmazonInvoiceShipmentInfo, getAmazonInvoiceHeader: getAmazonInvoiceHeader } diff --git a/app.js b/app.js index ee52914..a230f72 100644 --- a/app.js +++ b/app.js @@ -1,7 +1,4 @@ const express = require('express'); -var html_to_pdf = require('html-pdf-node'); -const report = require("puppeteer-report"); -//import puppeteer from "puppeteer"; const puppeteer = require('puppeteer') var Reportes = require('./Repository/Reportes'); const app = express() diff --git a/views - Copy/pages/Amazon/Invoice.ejs b/views - Copy/pages/Amazon/Invoice.ejs new file mode 100644 index 0000000..b80ea01 --- /dev/null +++ b/views - Copy/pages/Amazon/Invoice.ejs @@ -0,0 +1,34 @@ +<%- include('../../partials/Amazon/InvoiceHeader')%> + <%- include('../../partials/Amazon/ItemsTableHeader')%> + <% var ren=1; InvoiceDetail.forEach((item)=> { %> + + + <%= ren++ %> + + + <%= item.ItemId %> + + + <%= item.ItemDescription %> + + + <%= item.ItemQuantityUnitOfMeasure %> + + + <%= item.CountryOfOrigin %> + + + <%= item.Quantity %> + + + <%= item.WeightValue %> + + + <%= item.ActualUnitCostMonetaryAmount %> + + + <%= item.TotalUnitValueMonetaryAmount %> + + + <% }) %> + <%- include('../../partials/Amazon/InvoiceFooter')%> \ No newline at end of file diff --git a/views - Copy/partials/Amazon/InvoiceFooter.ejs b/views - Copy/partials/Amazon/InvoiceFooter.ejs new file mode 100644 index 0000000..3f7b5df --- /dev/null +++ b/views - Copy/partials/Amazon/InvoiceFooter.ejs @@ -0,0 +1,34 @@ + + + + + + + +
  + + + + + + + +
Total Qty:<% + var TotalWeight=0; + InvoiceDetail.forEach((item)=> { TotalWeight=TotalWeight+item.WeightValue }); %> + <%= TotalWeight.toString().substring(0,7) %> + TOTAL USD$:<%= InvoiceHeader.TotalInvoiceValueMonetaryAmount %>
+
+ + \ No newline at end of file diff --git a/views - Copy/partials/Amazon/InvoiceHeader.ejs b/views - Copy/partials/Amazon/InvoiceHeader.ejs new file mode 100644 index 0000000..ae5edfb --- /dev/null +++ b/views - Copy/partials/Amazon/InvoiceHeader.ejs @@ -0,0 +1,129 @@ + + + + + + + + + + + + + + + +
+ + + + + + + +
+
+
+
+ SELLER
+ <%= SellerL1 %>
+ <%= SellerL2 %>
+ <%= SellerL3 %> +
+
+
+
+
+
+
+ BILLER
+ <%= BillerL1 %>
+ <%= BillerL2 %>
+ <%= BillerL3 %> +
+
+
+
+
+ + + + + + + + + + +
+ +
+
+
+ Invoice No:
+ <%= InvoiceHeader.InvoiceNumber %> +
+
+
+
+
+
+
+ Amazon Shipment Reference Id:
+ <%= AmazonShipmentReferenceId %> +
+
+
+
+
+
+
+
+ Date:
+ <%= InvoiceHeader.CommercialInvoiceDate %> +
+
+
+
+
+
+ Incoterms:
+ <%= InvoiceHeader.Incoterms %> +
+
+
+
+
+
\ No newline at end of file diff --git a/views - Copy/partials/Amazon/Items.ejs b/views - Copy/partials/Amazon/Items.ejs new file mode 100644 index 0000000..e912846 --- /dev/null +++ b/views - Copy/partials/Amazon/Items.ejs @@ -0,0 +1,38 @@ +<%- include('../Amazon/partials/header')%> + <%- include('../Amazon/partials/tableHeader')%> + + <% + var ren=1; + InvoiceDetail.forEach((item)=> { %> + + + <%= ren++ %> + + + <%= item.ItemId %> + + + <%= item.ItemDescription %> + + + <%= item.ItemQuantityUnitOfMeasure %> + + + <%= item.CountryOfOrigin %> + + + <%= item.Quantity %> + + + <%= item.WeightValue %> + + + <%= item.ActualUnitCostMonetaryAmount %> + + + <%= item.TotalUnitValueMonetaryAmount %> + + + <% }) %> + + <%- include('../Amazon/partials/footer')%> \ No newline at end of file diff --git a/views - Copy/partials/Amazon/ItemsTableHeader.ejs b/views - Copy/partials/Amazon/ItemsTableHeader.ejs new file mode 100644 index 0000000..5a4c495 --- /dev/null +++ b/views - Copy/partials/Amazon/ItemsTableHeader.ejs @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/views/partials/Amazon/InvoiceFooter.ejs b/views/partials/Amazon/InvoiceFooter.ejs index 09314dc..f7818a1 100644 --- a/views/partials/Amazon/InvoiceFooter.ejs +++ b/views/partials/Amazon/InvoiceFooter.ejs @@ -13,14 +13,27 @@
OrdASIN#Description of GoodsUnit Meas.Country of OriginQty ShippedUnit Net Weight KgUnit Cost USDTotal Value USD
- - + + + diff --git a/views/partials/Amazon/InvoiceHeader.ejs b/views/partials/Amazon/InvoiceHeader.ejs index 50c1fe8..cc4fd8b 100644 --- a/views/partials/Amazon/InvoiceHeader.ejs +++ b/views/partials/Amazon/InvoiceHeader.ejs @@ -23,18 +23,6 @@
  +   - - - - + + + +
Total Qty:<%= InvoiceDetail.length %>TOTAL USD$:<%= InvoiceHeader.TotalInvoiceValueMonetaryAmount %>Total Net Weight Kg: + <% var TotalWeight=0; InvoiceDetail.forEach((item)=> { TotalWeight=TotalWeight+(item.Quantity * item.WeightValue) }); %> + <%= TotalWeight.toFixed(4) %> +
+
  + + + +
TOTAL USD$: + <% var Total=0; InvoiceDetail.forEach((item)=> { Total=Total+(item.Quantity * item.ActualUnitCostMonetaryAmount) }); %> + <%= Total.toFixed(4) %> +
- +
-
@@ -49,21 +37,6 @@
-
@@ -82,19 +55,9 @@
- +
@@ -105,16 +68,6 @@
-
-
@@ -125,24 +78,21 @@
+
--> +
+
+
+ Invoice No:
+ <%= InvoiceHeader.InvoiceNumber %> +
+
+
-
-
+
Amazon Shipment Reference Id:
<%= AmazonShipmentReferenceId %> @@ -153,24 +103,23 @@
- -
-
-
- Incoterms:
- <%= InvoiceHeader.Incoterms %> +
+
+
+
+ Date: <%= InvoiceHeader.CommercialInvoiceDate %>
+ Incoterms: <%= InvoiceHeader.Incoterms %> +
-
+ +
diff --git a/views/partials/Amazon/Items.ejs b/views/partials/Amazon/Items.ejs index 37cd83a..42f158c 100644 --- a/views/partials/Amazon/Items.ejs +++ b/views/partials/Amazon/Items.ejs @@ -1,7 +1,8 @@ <%- include('../Amazon/partials/header')%> <%- include('../Amazon/partials/tableHeader')%> - <% var ren=1; + <% + var ren=1; InvoiceDetail.forEach((item)=> { %> @@ -26,10 +27,10 @@ <%= item.WeightValue %> - <%= item.ActualUnitCostMonetaryAmount %> + <%= item.ActualUnitCostMonetaryAmount.toFixed(2) %> - <%= item.TotalUnitValueMonetaryAmount %> + <%= item.TotalUnitValueMonetaryAmount.toFixed(2) %> <% }) %>