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 %> |
+
+
+ |
+
+
+
+