mirror of
https://github.com/R0m1k3/LogiFlow.git
synced 2026-10-22 14:38:19 +02:00
3 files changed
+31
-15
No files matched your search
@@ -27,10 +27,6 @@ externalPort = 3000
|
|||||||
localPort = 38451
|
localPort = 38451
|
||||||
externalPort = 3002
|
externalPort = 3002
|
||||||
|
|
||||||
[[ports]]
|
|
||||||
localPort = 41035
|
|
||||||
externalPort = 5000
|
|
||||||
|
|
||||||
[[ports]]
|
[[ports]]
|
||||||
localPort = 41343
|
localPort = 41343
|
||||||
externalPort = 3001
|
externalPort = 3001
|
||||||
|
|||||||
Binary file not shown.
|
After Width: | Height: | Size: 13 KiB |
+31
-11
@@ -2876,12 +2876,14 @@ export class DatabaseStorage implements IStorage {
|
|||||||
|
|
||||||
// Apply filters
|
// Apply filters
|
||||||
if (filters.startDate) {
|
if (filters.startDate) {
|
||||||
orderConditions.push(gte(orders.plannedDate, filters.startDate));
|
const startDateStr = filters.startDate.toISOString().split('T')[0];
|
||||||
deliveryConditions.push(gte(deliveries.scheduledDate, filters.startDate));
|
orderConditions.push(gte(orders.plannedDate, startDateStr));
|
||||||
|
deliveryConditions.push(gte(deliveries.scheduledDate, startDateStr));
|
||||||
}
|
}
|
||||||
if (filters.endDate) {
|
if (filters.endDate) {
|
||||||
orderConditions.push(lte(orders.plannedDate, filters.endDate));
|
const endDateStr = filters.endDate.toISOString().split('T')[0];
|
||||||
deliveryConditions.push(lte(deliveries.scheduledDate, filters.endDate));
|
orderConditions.push(lte(orders.plannedDate, endDateStr));
|
||||||
|
deliveryConditions.push(lte(deliveries.scheduledDate, endDateStr));
|
||||||
}
|
}
|
||||||
if (filters.supplierIds?.length) {
|
if (filters.supplierIds?.length) {
|
||||||
orderConditions.push(inArray(orders.supplierId, filters.supplierIds));
|
orderConditions.push(inArray(orders.supplierId, filters.supplierIds));
|
||||||
@@ -2905,7 +2907,7 @@ export class DatabaseStorage implements IStorage {
|
|||||||
const deliveryQuery = db.select({
|
const deliveryQuery = db.select({
|
||||||
count: sql<number>`COUNT(*)`,
|
count: sql<number>`COUNT(*)`,
|
||||||
totalAmount: sql<number>`COALESCE(SUM(CAST(bl_amount AS NUMERIC)), 0) + COALESCE(SUM(CAST(invoice_amount AS NUMERIC)), 0)`,
|
totalAmount: sql<number>`COALESCE(SUM(CAST(bl_amount AS NUMERIC)), 0) + COALESCE(SUM(CAST(invoice_amount AS NUMERIC)), 0)`,
|
||||||
reconciled: sql<number>`COUNT(CASE WHEN reconciled = true OR reconciled = 1 THEN 1 END)`,
|
reconciled: sql<number>`COUNT(CASE WHEN reconciled = true THEN 1 END)`,
|
||||||
avgDelay: sql<number>`AVG(EXTRACT(EPOCH FROM (delivered_date - scheduled_date)) / 86400)` // days
|
avgDelay: sql<number>`AVG(EXTRACT(EPOCH FROM (delivered_date - scheduled_date)) / 86400)` // days
|
||||||
}).from(deliveries);
|
}).from(deliveries);
|
||||||
if (deliveryConditions.length) deliveryQuery.where(and(...deliveryConditions));
|
if (deliveryConditions.length) deliveryQuery.where(and(...deliveryConditions));
|
||||||
@@ -3053,8 +3055,14 @@ export class DatabaseStorage implements IStorage {
|
|||||||
groupIds?: number[];
|
groupIds?: number[];
|
||||||
}): Promise<Array<{ supplierId: number; supplierName: string; deliveries: number; amount: number }>> {
|
}): Promise<Array<{ supplierId: number; supplierName: string; deliveries: number; amount: number }>> {
|
||||||
const conditions: any[] = [];
|
const conditions: any[] = [];
|
||||||
if (filters.startDate) conditions.push(gte(deliveries.scheduledDate, filters.startDate));
|
if (filters.startDate) {
|
||||||
if (filters.endDate) conditions.push(lte(deliveries.scheduledDate, filters.endDate));
|
const startDateStr = filters.startDate.toISOString().split('T')[0];
|
||||||
|
conditions.push(gte(deliveries.scheduledDate, startDateStr));
|
||||||
|
}
|
||||||
|
if (filters.endDate) {
|
||||||
|
const endDateStr = filters.endDate.toISOString().split('T')[0];
|
||||||
|
conditions.push(lte(deliveries.scheduledDate, endDateStr));
|
||||||
|
}
|
||||||
if (filters.groupIds?.length) conditions.push(inArray(deliveries.groupId, filters.groupIds));
|
if (filters.groupIds?.length) conditions.push(inArray(deliveries.groupId, filters.groupIds));
|
||||||
|
|
||||||
const query = db.select({
|
const query = db.select({
|
||||||
@@ -5146,8 +5154,14 @@ export class MemStorage implements IStorage {
|
|||||||
|
|
||||||
// Apply filters
|
// Apply filters
|
||||||
const filteredOrders = orders.filter(order => {
|
const filteredOrders = orders.filter(order => {
|
||||||
if (filters.startDate && order.plannedDate < filters.startDate) return false;
|
if (filters.startDate) {
|
||||||
if (filters.endDate && order.plannedDate > filters.endDate) return false;
|
const orderDate = new Date(order.plannedDate);
|
||||||
|
if (orderDate < filters.startDate) return false;
|
||||||
|
}
|
||||||
|
if (filters.endDate) {
|
||||||
|
const orderDate = new Date(order.plannedDate);
|
||||||
|
if (orderDate > filters.endDate) return false;
|
||||||
|
}
|
||||||
if (filters.supplierIds?.length && !filters.supplierIds.includes(order.supplierId)) return false;
|
if (filters.supplierIds?.length && !filters.supplierIds.includes(order.supplierId)) return false;
|
||||||
if (filters.groupIds?.length && !filters.groupIds.includes(order.groupId)) return false;
|
if (filters.groupIds?.length && !filters.groupIds.includes(order.groupId)) return false;
|
||||||
if (filters.status?.length && !filters.status.includes(order.status)) return false;
|
if (filters.status?.length && !filters.status.includes(order.status)) return false;
|
||||||
@@ -5155,8 +5169,14 @@ export class MemStorage implements IStorage {
|
|||||||
});
|
});
|
||||||
|
|
||||||
const filteredDeliveries = deliveries.filter(delivery => {
|
const filteredDeliveries = deliveries.filter(delivery => {
|
||||||
if (filters.startDate && delivery.scheduledDate < filters.startDate) return false;
|
if (filters.startDate) {
|
||||||
if (filters.endDate && delivery.scheduledDate > filters.endDate) return false;
|
const deliveryDate = new Date(delivery.scheduledDate);
|
||||||
|
if (deliveryDate < filters.startDate) return false;
|
||||||
|
}
|
||||||
|
if (filters.endDate) {
|
||||||
|
const deliveryDate = new Date(delivery.scheduledDate);
|
||||||
|
if (deliveryDate > filters.endDate) return false;
|
||||||
|
}
|
||||||
if (filters.supplierIds?.length && !filters.supplierIds.includes(delivery.supplierId)) return false;
|
if (filters.supplierIds?.length && !filters.supplierIds.includes(delivery.supplierId)) return false;
|
||||||
if (filters.groupIds?.length && !filters.groupIds.includes(delivery.groupId)) return false;
|
if (filters.groupIds?.length && !filters.groupIds.includes(delivery.groupId)) return false;
|
||||||
if (filters.status?.length && !filters.status.includes(delivery.status)) return false;
|
if (filters.status?.length && !filters.status.includes(delivery.status)) return false;
|
||||||
|
|||||||
Reference in new issue
Block a user