.
This commit is contained in:
@@ -25,12 +25,12 @@ export class accountingSearch {
|
|||||||
try {
|
try {
|
||||||
// let username = req.body.request.username;
|
// let username = req.body.request.username;
|
||||||
// let password = req.body.request.password;
|
// let password = req.body.request.password;
|
||||||
let token = req.body.request.token;
|
let token = req.headers.authorization?.split(' ')[1];''
|
||||||
const decoded = verifyToken(token);
|
const decoded = verifyToken(token);
|
||||||
|
|
||||||
let id = decoded.id
|
let id = decoded.id
|
||||||
let username = decoded.name
|
let username = decoded.name
|
||||||
database = decoded.organization
|
database = decoded.organization
|
||||||
|
|
||||||
aryResult = await this.accountingSearchService.getAccountingSearch(database, id, username); // เช็คกับ db กลาง ส่ง jwttoken ออกมา
|
aryResult = await this.accountingSearchService.getAccountingSearch(database, id, username); // เช็คกับ db กลาง ส่ง jwttoken ออกมา
|
||||||
// this.generalService.devhint(1, 'accountingSearch.js', 'Login success');
|
// this.generalService.devhint(1, 'accountingSearch.js', 'Login success');
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ export class accountingSetup {
|
|||||||
try {
|
try {
|
||||||
// let username = req.body.request.username;
|
// let username = req.body.request.username;
|
||||||
// let password = req.body.request.password;
|
// let password = req.body.request.password;
|
||||||
let token = req.body.request.token;
|
let token = req.headers.authorization?.split(' ')[1];
|
||||||
const decoded = verifyToken(token);
|
const decoded = verifyToken(token);
|
||||||
|
|
||||||
database = decoded.organization
|
database = decoded.organization
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ export class accountingSum {
|
|||||||
let result = []
|
let result = []
|
||||||
var aryResult
|
var aryResult
|
||||||
try {
|
try {
|
||||||
let token = req.body.request.token;
|
let token = req.headers.authorization?.split(' ')[1];
|
||||||
const decoded = verifyToken(token);
|
const decoded = verifyToken(token);
|
||||||
|
|
||||||
let id = decoded.id
|
let id = decoded.id
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ export class reportController {
|
|||||||
let token = req.headers.authorization?.split(' ')[1];
|
let token = req.headers.authorization?.split(' ')[1];
|
||||||
const decoded = verifyToken(token);
|
const decoded = verifyToken(token);
|
||||||
|
|
||||||
let actnum = req.body.request.actnum;
|
let actnum = decoded.id;
|
||||||
database = decoded.organization;
|
database = decoded.organization;
|
||||||
|
|
||||||
aryResult = await this.reportService.getReportController(database, actnum);
|
aryResult = await this.reportService.getReportController(database, actnum);
|
||||||
@@ -52,7 +52,7 @@ export class reportController {
|
|||||||
return aryResult;
|
return aryResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ✅ 2) แยก income / expense
|
// 2) แยก income / expense
|
||||||
const incomeList = data.filter(i => i.acttyp === 'i');
|
const incomeList = data.filter(i => i.acttyp === 'i');
|
||||||
const expenseList = data.filter(e => e.acttyp === 'e');
|
const expenseList = data.filter(e => e.acttyp === 'e');
|
||||||
|
|
||||||
@@ -63,11 +63,13 @@ export class reportController {
|
|||||||
const profitRate = totalIncome > 0 ? (netProfit / totalIncome) * 100 : 0;
|
const profitRate = totalIncome > 0 ? (netProfit / totalIncome) * 100 : 0;
|
||||||
const adjustedProfitRate = profitRate + 1.9;
|
const adjustedProfitRate = profitRate + 1.9;
|
||||||
|
|
||||||
// ✅ 3) แนบ summary (เหมือนที่เราทำไปก่อนหน้า)
|
// 3) แนบ summary (เหมือนที่เราทำไปก่อนหน้า)
|
||||||
var summary = {
|
var summary = {
|
||||||
totalIncome: totalIncome.toFixed(2),
|
totalIncome: totalIncome.toFixed(2),
|
||||||
totalExpense: totalExpense.toFixed(2),
|
totalExpense: totalExpense.toFixed(2),
|
||||||
netProfit: netProfit.toFixed(2),
|
netProfit: netProfit.toFixed(2),
|
||||||
|
profitRate: profitRate.toFixed(2) + ' %',
|
||||||
|
period: '30 วัน'
|
||||||
};
|
};
|
||||||
|
|
||||||
// ✅ 3.5) Create actdata table with required fields grouped by actnum
|
// ✅ 3.5) Create actdata table with required fields grouped by actnum
|
||||||
|
|||||||
Reference in New Issue
Block a user