Compare commits
2 Commits
1187693df8
...
90f2c2efee
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
90f2c2efee | ||
|
|
366d6d1f4d |
@@ -28,7 +28,7 @@ export class ListsController {
|
|||||||
* Consulta tabela de checkouts da filial informada
|
* Consulta tabela de checkouts da filial informada
|
||||||
*/
|
*/
|
||||||
@Get('checkout/:store')
|
@Get('checkout/:store')
|
||||||
@ApiParam({name: 'Código da filial',})
|
@ApiParam({ name: 'Código da filial', })
|
||||||
async getCheckout(@Param('store') idStore: string) {
|
async getCheckout(@Param('store') idStore: string) {
|
||||||
return this.listsServices.GetCheckout(idStore);
|
return this.listsServices.GetCheckout(idStore);
|
||||||
}
|
}
|
||||||
@@ -44,9 +44,9 @@ export class ListsController {
|
|||||||
/**
|
/**
|
||||||
* Consulta tabela de plano de pagamento para pedido de venda
|
* Consulta tabela de plano de pagamento para pedido de venda
|
||||||
*/
|
*/
|
||||||
@Get('paymentplan/:billindid')
|
@Get('paymentplan/:billindid/:customerId')
|
||||||
async getPaymentPlan(@Param('billindid') billingId: string) {
|
async getPaymentPlan(@Param('billindid') billingId: string, @Param('customerId') customerId: string) {
|
||||||
return this.listsServices.GetPaymentPlan(billingId);
|
return this.listsServices.GetPaymentPlan(billingId, customerId);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ export class ListsService {
|
|||||||
const checkouts = await queryRunner.manager
|
const checkouts = await queryRunner.manager
|
||||||
.getRepository(Checkout)
|
.getRepository(Checkout)
|
||||||
.createQueryBuilder('pccaixa')
|
.createQueryBuilder('pccaixa')
|
||||||
.where("\"pccaixa\".CODFILIAL = :idStore", {idStore: idStore})
|
.where("\"pccaixa\".CODFILIAL = :idStore", { idStore: idStore })
|
||||||
.orderBy("\"pccaixa\".NUMCAIXA")
|
.orderBy("\"pccaixa\".NUMCAIXA")
|
||||||
.getMany();
|
.getMany();
|
||||||
return checkouts;
|
return checkouts;
|
||||||
@@ -89,7 +89,7 @@ export class ListsService {
|
|||||||
.getRepository(Pcempr)
|
.getRepository(Pcempr)
|
||||||
.createQueryBuilder('pcempr')
|
.createQueryBuilder('pcempr')
|
||||||
.select("\"pcempr\".matricula as \"id\", \"pcempr\".nome as \"name\", \"pcempr\".email as \"email\", \"pcempr\".usuariobd as \"smallName\"")
|
.select("\"pcempr\".matricula as \"id\", \"pcempr\".nome as \"name\", \"pcempr\".email as \"email\", \"pcempr\".usuariobd as \"smallName\"")
|
||||||
.where("\"pcempr\".CODFILIAL = :idStore", {idStore: idStore})
|
.where("\"pcempr\".CODFILIAL = :idStore", { idStore: idStore })
|
||||||
.orderBy("\"pcempr\".NOME")
|
.orderBy("\"pcempr\".NOME")
|
||||||
.getRawMany();
|
.getRawMany();
|
||||||
return checkouts;
|
return checkouts;
|
||||||
@@ -102,20 +102,24 @@ export class ListsService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async GetPaymentPlan(billingId: string){
|
async GetPaymentPlan(billingId: string, clientId: string) {
|
||||||
const connection = new Connection(connectionOptions);
|
const connection = new Connection(connectionOptions);
|
||||||
await connection.connect();
|
await connection.connect();
|
||||||
const queryRunner = connection.createQueryRunner();
|
const queryRunner = connection.createQueryRunner();
|
||||||
await queryRunner.connect();
|
await queryRunner.connect();
|
||||||
try {
|
try {
|
||||||
const sql = ' SELECT PCPLPAG.CODPLPAG as "codplpag", PCPLPAG.DESCRICAO as "descricao", ' +
|
const sql = `SELECT PCPLPAG.CODPLPAG as "codplpag", PCPLPAG.DESCRICAO as "descricao",
|
||||||
' NVL(PCPLPAG.NUMDIAS,0) as "numdias" ' +
|
NVL(PCPLPAG.NUMDIAS,0) as "numdias"
|
||||||
' FROM PCPLPAG ' +
|
FROM PCPLPAG, PCCLIENT, PCPLPAG PLANO_CLI
|
||||||
' WHERE EXISTS(SELECT PCCOBPLPAG.CODCOB FROM PCCOBPLPAG ' +
|
WHERE PCCLIENT.CODCLI = :CODCLI
|
||||||
' WHERE PCCOBPLPAG.CODPLPAG = PCPLPAG.CODPLPAG ' +
|
AND PCCLIENT.CODPLPAG = PLANO_CLI.CODPLPAG (+)
|
||||||
' AND PCCOBPLPAG.CODCOB = :CODCOB ) '
|
AND PCPLPAG.NUMDIAS <= NVL(PLANO_CLI.NUMDIAS,9999)
|
||||||
' ORDER BY PCPAG.DESCRICAO ';
|
AND EXISTS(SELECT PCCOBPLPAG.CODCOB FROM PCCOBPLPAG
|
||||||
const paymentPlans = await queryRunner.query(sql, [billingId]);
|
WHERE PCCOBPLPAG.CODPLPAG = PCPLPAG.CODPLPAG
|
||||||
|
AND PCCOBPLPAG.CODCOB = :CODCOB )
|
||||||
|
ORDER BY PCPLPAG.DESCRICAO`;
|
||||||
|
|
||||||
|
const paymentPlans = await queryRunner.query(sql, [clientId, billingId]);
|
||||||
return paymentPlans;
|
return paymentPlans;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
throw error;
|
throw error;
|
||||||
@@ -125,7 +129,7 @@ export class ListsService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async GetBilling(clienteId: number){
|
async GetBilling(clienteId: number) {
|
||||||
const connection = new Connection(connectionOptions);
|
const connection = new Connection(connectionOptions);
|
||||||
await connection.connect();
|
await connection.connect();
|
||||||
const queryRunner = connection.createQueryRunner();
|
const queryRunner = connection.createQueryRunner();
|
||||||
@@ -135,7 +139,7 @@ export class ListsService {
|
|||||||
' FROM PCCOB ' +
|
' FROM PCCOB ' +
|
||||||
' WHERE NVL(PCCOB.enviacobrancafv, \'N\') = \'S\' ' +
|
' WHERE NVL(PCCOB.enviacobrancafv, \'N\') = \'S\' ' +
|
||||||
' AND ( ( NOT EXISTS(SELECT PCCOBCLI.CODCOB FROM PCCOBCLI WHERE PCCOBCLI.CODCLI = :CODCLI ) AND ' +
|
' AND ( ( NOT EXISTS(SELECT PCCOBCLI.CODCOB FROM PCCOBCLI WHERE PCCOBCLI.CODCLI = :CODCLI ) AND ' +
|
||||||
' ( PCCOB.NIVELVENDA <= ( SELECT C.NIVELVENDA FROM PCCLIENT, PCCOB C ' +
|
' ( PCCOB.NIVELVENDA >= ( SELECT C.NIVELVENDA FROM PCCLIENT, PCCOB C ' +
|
||||||
' WHERE PCCLIENT.CODCLI = :CODCLI AND PCCLIENT.CODCOB = C.CODCOB ) ) ) OR ' +
|
' WHERE PCCLIENT.CODCLI = :CODCLI AND PCCLIENT.CODCOB = C.CODCOB ) ) ) OR ' +
|
||||||
' EXISTS(SELECT PCCOBCLI.CODCOB FROM PCCOBCLI WHERE PCCOBCLI.CODCLI = :CODCLI AND PCCOBCLI.CODCOB = PCCOB.CODCOB ) ) ' +
|
' EXISTS(SELECT PCCOBCLI.CODCOB FROM PCCOBCLI WHERE PCCOBCLI.CODCLI = :CODCLI AND PCCOBCLI.CODCOB = PCCOB.CODCOB ) ) ' +
|
||||||
' ORDER BY PCCOB.CODCOB';
|
' ORDER BY PCCOB.CODCOB';
|
||||||
@@ -149,7 +153,7 @@ export class ListsService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async GetPartners(){
|
async GetPartners() {
|
||||||
const connection = new Connection(connectionOptions);
|
const connection = new Connection(connectionOptions);
|
||||||
await connection.connect();
|
await connection.connect();
|
||||||
const queryRunner = connection.createQueryRunner();
|
const queryRunner = connection.createQueryRunner();
|
||||||
@@ -170,13 +174,13 @@ export class ListsService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async GetPreCustomer(idCart: string){
|
async GetPreCustomer(idCart: string) {
|
||||||
const connection = new Connection(connectionOptions);
|
const connection = new Connection(connectionOptions);
|
||||||
await connection.connect();
|
await connection.connect();
|
||||||
const queryRunner = connection.createQueryRunner();
|
const queryRunner = connection.createQueryRunner();
|
||||||
await queryRunner.connect();
|
await queryRunner.connect();
|
||||||
try {
|
try {
|
||||||
const sql = ' select CPF as "document" '+
|
const sql = ' select CPF as "document" ' +
|
||||||
' ,NOME as "name" ' +
|
' ,NOME as "name" ' +
|
||||||
' ,TELEFONE as "phone" ' +
|
' ,TELEFONE as "phone" ' +
|
||||||
' ,IDCART as "idCart" ' +
|
' ,IDCART as "idCart" ' +
|
||||||
@@ -195,7 +199,7 @@ export class ListsService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async GetPlaces(){
|
async GetPlaces() {
|
||||||
const connection = new Connection(connectionOptions);
|
const connection = new Connection(connectionOptions);
|
||||||
await connection.connect();
|
await connection.connect();
|
||||||
const queryRunner = connection.createQueryRunner();
|
const queryRunner = connection.createQueryRunner();
|
||||||
@@ -216,7 +220,7 @@ export class ListsService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async GetStorePlaces(){
|
async GetStorePlaces() {
|
||||||
const connection = new Connection(connectionOptions);
|
const connection = new Connection(connectionOptions);
|
||||||
await connection.connect();
|
await connection.connect();
|
||||||
const queryRunner = connection.createQueryRunner();
|
const queryRunner = connection.createQueryRunner();
|
||||||
@@ -237,7 +241,7 @@ export class ListsService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async GetRamo(){
|
async GetRamo() {
|
||||||
const connection = new Connection(connectionOptions);
|
const connection = new Connection(connectionOptions);
|
||||||
await connection.connect();
|
await connection.connect();
|
||||||
const queryRunner = connection.createQueryRunner();
|
const queryRunner = connection.createQueryRunner();
|
||||||
@@ -259,7 +263,7 @@ export class ListsService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async GetStates(state: string){
|
async GetStates(state: string) {
|
||||||
const connection = new Connection(connectionOptions);
|
const connection = new Connection(connectionOptions);
|
||||||
await connection.connect();
|
await connection.connect();
|
||||||
const queryRunner = connection.createQueryRunner();
|
const queryRunner = connection.createQueryRunner();
|
||||||
@@ -278,7 +282,7 @@ export class ListsService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async getSupervisores(){
|
async getSupervisores() {
|
||||||
const connection = new Connection(connectionOptions);
|
const connection = new Connection(connectionOptions);
|
||||||
await connection.connect();
|
await connection.connect();
|
||||||
const queryRunner = connection.createQueryRunner();
|
const queryRunner = connection.createQueryRunner();
|
||||||
@@ -299,4 +303,4 @@ export class ListsService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -469,9 +469,9 @@ export class CustomerService {
|
|||||||
async InitializeCustomer() {
|
async InitializeCustomer() {
|
||||||
const cliente = new Pcclient();
|
const cliente = new Pcclient();
|
||||||
cliente.codusur1 = 1;
|
cliente.codusur1 = 1;
|
||||||
cliente.codplpag = 10;
|
cliente.codplpag = 18;
|
||||||
cliente.codpraca = 119;
|
cliente.codpraca = 169;
|
||||||
cliente.codcob = "D";
|
cliente.codcob = "CAR";
|
||||||
cliente.dtcadastro = new Date();
|
cliente.dtcadastro = new Date();
|
||||||
cliente.codcontab = "1";
|
cliente.codcontab = "1";
|
||||||
cliente.aceitavendafracao = "N";
|
cliente.aceitavendafracao = "N";
|
||||||
@@ -502,7 +502,7 @@ export class CustomerService {
|
|||||||
cliente.tv10usacustoproduto = "N";
|
cliente.tv10usacustoproduto = "N";
|
||||||
cliente.inscestadual = "ISENTO";
|
cliente.inscestadual = "ISENTO";
|
||||||
cliente.codpais = 1058; //Brasil
|
cliente.codpais = 1058; //Brasil
|
||||||
cliente.observacao = "Importado do E-Commerce";
|
cliente.observacao = "Cadastrado Venda Web";
|
||||||
cliente.aceitachterceiros = "S";
|
cliente.aceitachterceiros = "S";
|
||||||
cliente.agregarvalorstdescfin = "N";
|
cliente.agregarvalorstdescfin = "N";
|
||||||
cliente.anvisa = "N";
|
cliente.anvisa = "N";
|
||||||
|
|||||||
@@ -954,7 +954,7 @@ export class OrderService {
|
|||||||
const partners = await this.listsService.GetPartners();
|
const partners = await this.listsService.GetPartners();
|
||||||
const address = await this.addressCustomerService.getAddress(order[0].customerId, order[0].addressId);
|
const address = await this.addressCustomerService.getAddress(order[0].customerId, order[0].addressId);
|
||||||
const billing = billinds.find(data => data.codcob === order[0].billindId);
|
const billing = billinds.find(data => data.codcob === order[0].billindId);
|
||||||
const paymentPlans = await this.listsService.GetPaymentPlan(billing.codcob);
|
const paymentPlans = await this.listsService.GetPaymentPlan(billing.codcob, order[0].customerId);
|
||||||
const paymentPlan = paymentPlans.find(data => data.codplpag === order[0].paymentPlanId);
|
const paymentPlan = paymentPlans.find(data => data.codplpag === order[0].paymentPlanId);
|
||||||
const partner = partners.find(data => data.id === order[0].partnerId);
|
const partner = partners.find(data => data.id === order[0].partnerId);
|
||||||
|
|
||||||
|
|||||||
@@ -425,7 +425,7 @@ export class PreOrderService {
|
|||||||
}
|
}
|
||||||
// const address = await this.addressCustomerService.getAddress(preOrder[0].customerId, preOrder[0].addressId);
|
// const address = await this.addressCustomerService.getAddress(preOrder[0].customerId, preOrder[0].addressId);
|
||||||
const billing = billinds.find(data => data.codcob === preOrder[0].billindId);
|
const billing = billinds.find(data => data.codcob === preOrder[0].billindId);
|
||||||
const paymentPlans = await this.listsService.GetPaymentPlan((billing !== null && billing !== undefined) ? billing.codcob : '9999');
|
const paymentPlans = await this.listsService.GetPaymentPlan((billing !== null && billing !== undefined) ? billing.codcob : '9999', preOrder[0].customerId);
|
||||||
const paymentPlan = paymentPlans.find(data => data.codplpag === preOrder[0].paymentPlanId);
|
const paymentPlan = paymentPlans.find(data => data.codplpag === preOrder[0].paymentPlanId);
|
||||||
const partner = partners.find(data => data.id === preOrder[0].partnerId);
|
const partner = partners.find(data => data.id === preOrder[0].partnerId);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user