ofpos-shared-core 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +37 -0
- package/dist/AdapterRegistry.d.ts +83 -0
- package/dist/DomainServices.d.ts +151 -0
- package/dist/IntegrationServices.d.ts +75 -0
- package/dist/PosCore.d.ts +216 -0
- package/dist/contracts/contractVersioning.d.ts +6 -0
- package/dist/contracts/crossDomainPrimitives.d.ts +5 -0
- package/dist/contracts/responseEnvelope.d.ts +6 -0
- package/dist/contracts/syncProtocol.d.ts +8 -0
- package/dist/data/DbAdapter.d.ts +7 -0
- package/dist/data/applyPendingMigrations.d.ts +18 -0
- package/dist/data/inMemoryDbAdapter.d.ts +65 -0
- package/dist/data/migrations.d.ts +12 -0
- package/dist/data/relations.d.ts +3 -0
- package/dist/data/schema.d.ts +9 -0
- package/dist/data/seed.d.ts +370 -0
- package/dist/index.browser.mjs +18 -0
- package/dist/index.browser.mjs.LEGAL.txt +46 -0
- package/dist/index.cjs.js +18 -0
- package/dist/index.cjs.js.LEGAL.txt +46 -0
- package/dist/index.d.ts +116 -0
- package/dist/index.esm.js +18 -0
- package/dist/index.esm.js.LEGAL.txt +46 -0
- package/dist/index.umd.js +18 -0
- package/dist/index.umd.js.LEGAL.txt +46 -0
- package/dist/integration/NotificationAdapter.d.ts +69 -0
- package/dist/integration/activityLogger.d.ts +44 -0
- package/dist/integration/activitySink.d.ts +8 -0
- package/dist/integration/apiService.d.ts +255 -0
- package/dist/integration/authorizationService.d.ts +225 -0
- package/dist/integration/backupScheduler.d.ts +75 -0
- package/dist/integration/checksum.d.ts +9 -0
- package/dist/integration/checksumAdapter.d.ts +8 -0
- package/dist/integration/configService.d.ts +431 -0
- package/dist/integration/defaultChecksumAdapter.d.ts +6 -0
- package/dist/integration/defaultEncryptionAdapter.d.ts +9 -0
- package/dist/integration/encryption.d.ts +95 -0
- package/dist/integration/encryptionAdapter.d.ts +8 -0
- package/dist/integration/httpAdapter.d.ts +9 -0
- package/dist/integration/loggerAdapter.d.ts +45 -0
- package/dist/integration/notificationService.d.ts +45 -0
- package/dist/integration/ofauthBridge.d.ts +29 -0
- package/dist/integration/ofauthCoreBridge.d.ts +19 -0
- package/dist/integration/platformAdapter.d.ts +8 -0
- package/dist/integration/roleAdapter.d.ts +61 -0
- package/dist/integration/socket.d.ts +60 -0
- package/dist/integration/socketAdapter.d.ts +8 -0
- package/dist/integration/userService.d.ts +126 -0
- package/dist/models/Bom.d.ts +17 -0
- package/dist/models/Category.d.ts +13 -0
- package/dist/models/Customer.d.ts +17 -0
- package/dist/models/CustomerGroup.d.ts +11 -0
- package/dist/models/Expense.d.ts +19 -0
- package/dist/models/FinancialSetting.d.ts +14 -0
- package/dist/models/History.d.ts +18 -0
- package/dist/models/InventoryLog.d.ts +23 -0
- package/dist/models/InventoryLot.d.ts +34 -0
- package/dist/models/KitchenTicket.d.ts +13 -0
- package/dist/models/KitchenTicketItem.d.ts +12 -0
- package/dist/models/LoyaltyAccount.d.ts +12 -0
- package/dist/models/LoyaltyLedger.d.ts +17 -0
- package/dist/models/Order.d.ts +45 -0
- package/dist/models/OrderItem.d.ts +19 -0
- package/dist/models/Payable.d.ts +23 -0
- package/dist/models/PriceHistory.d.ts +17 -0
- package/dist/models/PriceTier.d.ts +19 -0
- package/dist/models/Product.d.ts +25 -0
- package/dist/models/Promotion.d.ts +25 -0
- package/dist/models/Purchase.d.ts +29 -0
- package/dist/models/PurchaseItem.d.ts +21 -0
- package/dist/models/PurchaseOrder.d.ts +23 -0
- package/dist/models/PurchaseOrderItem.d.ts +19 -0
- package/dist/models/Receivable.d.ts +23 -0
- package/dist/models/ReportSchedule.d.ts +21 -0
- package/dist/models/Return.d.ts +57 -0
- package/dist/models/ReturnItem.d.ts +31 -0
- package/dist/models/Role.d.ts +13 -0
- package/dist/models/Sale.d.ts +43 -0
- package/dist/models/SaleItem.d.ts +19 -0
- package/dist/models/Settlement.d.ts +23 -0
- package/dist/models/Shift.d.ts +41 -0
- package/dist/models/StockAdjustment.d.ts +21 -0
- package/dist/models/StockOpname.d.ts +22 -0
- package/dist/models/StockOpnameItem.d.ts +27 -0
- package/dist/models/Supplier.d.ts +19 -0
- package/dist/models/TaxRate.d.ts +13 -0
- package/dist/models/Transaction.d.ts +32 -0
- package/dist/models/Uom.d.ts +15 -0
- package/dist/models/User.d.ts +21 -0
- package/dist/services/bomService.d.ts +71 -0
- package/dist/services/cartService.d.ts +65 -0
- package/dist/services/categoryService.d.ts +54 -0
- package/dist/services/customerGroupService.d.ts +47 -0
- package/dist/services/customerService.d.ts +133 -0
- package/dist/services/documentNumberPolicy.d.ts +15 -0
- package/dist/services/expenseService.d.ts +47 -0
- package/dist/services/exportAdapter.d.ts +48 -0
- package/dist/services/exportService.d.ts +263 -0
- package/dist/services/financialSettingService.d.ts +47 -0
- package/dist/services/historyService.d.ts +60 -0
- package/dist/services/inventoryLogService.d.ts +47 -0
- package/dist/services/inventoryService.d.ts +43 -0
- package/dist/services/orderItemService.d.ts +47 -0
- package/dist/services/orderService.d.ts +161 -0
- package/dist/services/payableService.d.ts +51 -0
- package/dist/services/priceHistoryService.d.ts +61 -0
- package/dist/services/priceTierService.d.ts +47 -0
- package/dist/services/pricingService.d.ts +192 -0
- package/dist/services/productService.d.ts +59 -0
- package/dist/services/promotionService.d.ts +47 -0
- package/dist/services/purchaseItemService.d.ts +47 -0
- package/dist/services/purchaseOrderItemService.d.ts +47 -0
- package/dist/services/purchaseOrderService.d.ts +47 -0
- package/dist/services/purchaseService.d.ts +130 -0
- package/dist/services/receivableService.d.ts +47 -0
- package/dist/services/reportScheduleService.d.ts +47 -0
- package/dist/services/reportingService.d.ts +251 -0
- package/dist/services/returnItemService.d.ts +47 -0
- package/dist/services/returnService.d.ts +123 -0
- package/dist/services/roleService.d.ts +47 -0
- package/dist/services/saleItemService.d.ts +47 -0
- package/dist/services/saleService.d.ts +154 -0
- package/dist/services/settlementService.d.ts +68 -0
- package/dist/services/shiftService.d.ts +92 -0
- package/dist/services/stockAdjustmentService.d.ts +47 -0
- package/dist/services/stockOpnameItemService.d.ts +47 -0
- package/dist/services/stockOpnameService.d.ts +51 -0
- package/dist/services/stockTransferService.d.ts +67 -0
- package/dist/services/supplierService.d.ts +51 -0
- package/dist/services/taxRateService.d.ts +47 -0
- package/dist/services/taxService.d.ts +63 -0
- package/dist/services/transactionService.d.ts +109 -0
- package/dist/services/uiProductService.d.ts +102 -0
- package/dist/services/uiTransactionService.d.ts +68 -0
- package/dist/services/uomService.d.ts +53 -0
- package/dist/services/userService.d.ts +47 -0
- package/dist/stores/cartStore.d.ts +109 -0
- package/dist/stores/eventBus.d.ts +55 -0
- package/dist/stores/sessionStore.d.ts +108 -0
- package/dist/stores/storageAdapter.d.ts +44 -0
- package/dist/stores/syncService.d.ts +90 -0
- package/dist/stores/syncStore.d.ts +163 -0
- package/package.json +82 -0
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { PosCore } from '../PosCore';
|
|
2
|
+
import { DbAdapter, QueryOptions } from 'ofcore';
|
|
3
|
+
import { Payable, PayableData } from '../models/Payable';
|
|
4
|
+
/** Service interface for Payable operations. */
|
|
5
|
+
export interface IPayableService {
|
|
6
|
+
/** Add new Payable. */
|
|
7
|
+
addPayable(data: PayableData, tx?: DbAdapter): Promise<Payable>;
|
|
8
|
+
/** Update existing Payable. */
|
|
9
|
+
updatePayable(id: string, data: Partial<PayableData>): Promise<Payable>;
|
|
10
|
+
/** Get all Payables with complex options. */
|
|
11
|
+
getPayables(options?: QueryOptions, tx?: DbAdapter): Promise<Payable[]>;
|
|
12
|
+
/** Get Payable by ID or options. */
|
|
13
|
+
getPayable(idOrOptions: string | QueryOptions, tx?: DbAdapter): Promise<Payable | null>;
|
|
14
|
+
/** Delete Payable (logical). */
|
|
15
|
+
deletePayable(id: string, tx?: DbAdapter): Promise<{
|
|
16
|
+
id: string;
|
|
17
|
+
queued: boolean;
|
|
18
|
+
}>;
|
|
19
|
+
/** Duplicate Payable by ID. */
|
|
20
|
+
duplicatePayable(originalId: string, tx?: DbAdapter): Promise<Payable>;
|
|
21
|
+
/** Update paid amount for a payable */
|
|
22
|
+
updatePaidAmount(payableId: string, amount: number): Promise<void>;
|
|
23
|
+
}
|
|
24
|
+
/** Service implementation for Payable operations. */
|
|
25
|
+
export declare class PayableService implements IPayableService {
|
|
26
|
+
private context;
|
|
27
|
+
private dbAdapter;
|
|
28
|
+
private syncStore?;
|
|
29
|
+
/**
|
|
30
|
+
* Initialize PayableService.
|
|
31
|
+
* @param context - PosCore context
|
|
32
|
+
*/
|
|
33
|
+
constructor(context: PosCore);
|
|
34
|
+
/** Add new Payable. */
|
|
35
|
+
addPayable(data: PayableData, tx?: DbAdapter): Promise<Payable>;
|
|
36
|
+
/** Update existing Payable. */
|
|
37
|
+
updatePayable(id: string, data: Partial<PayableData>, tx?: DbAdapter): Promise<Payable>;
|
|
38
|
+
/** Get all Payables with complex options. */
|
|
39
|
+
getPayables(options?: QueryOptions, tx?: DbAdapter): Promise<Payable[]>;
|
|
40
|
+
/** Get Payable by ID or options. */
|
|
41
|
+
getPayable(idOrOptions: string | QueryOptions, tx?: DbAdapter): Promise<Payable | null>;
|
|
42
|
+
/** Delete Payable (logical). */
|
|
43
|
+
deletePayable(id: string, tx?: DbAdapter): Promise<{
|
|
44
|
+
id: string;
|
|
45
|
+
queued: boolean;
|
|
46
|
+
}>;
|
|
47
|
+
/** Duplicate Payable by ID. */
|
|
48
|
+
duplicatePayable(originalId: string, tx?: DbAdapter): Promise<Payable>;
|
|
49
|
+
/** Update paid amount for a payable */
|
|
50
|
+
updatePaidAmount(payableId: string, amount: number): Promise<void>;
|
|
51
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { PosCore } from '../PosCore';
|
|
2
|
+
import { DbAdapter, QueryOptions } from 'ofcore';
|
|
3
|
+
import { PriceHistory, PriceHistoryData } from '../models/PriceHistory';
|
|
4
|
+
/** Service interface for PriceHistory operations. */
|
|
5
|
+
export interface IPriceHistoryService {
|
|
6
|
+
/** Add new PriceHistory. */
|
|
7
|
+
addPriceHistory(data: PriceHistoryData, tx?: DbAdapter): Promise<PriceHistory>;
|
|
8
|
+
/** Update existing PriceHistory. */
|
|
9
|
+
updatePriceHistory(id: string, data: Partial<PriceHistoryData>): Promise<PriceHistory>;
|
|
10
|
+
/** Get all PriceHistories with complex options. */
|
|
11
|
+
getPriceHistories(options?: QueryOptions, tx?: DbAdapter): Promise<PriceHistory[]>;
|
|
12
|
+
/** Get PriceHistory by ID or options. */
|
|
13
|
+
getPriceHistory(idOrOptions: string | QueryOptions, tx?: DbAdapter): Promise<PriceHistory | null>;
|
|
14
|
+
/** Delete PriceHistory (logical). */
|
|
15
|
+
deletePriceHistory(id: string, tx?: DbAdapter): Promise<{
|
|
16
|
+
id: string;
|
|
17
|
+
queued: boolean;
|
|
18
|
+
}>;
|
|
19
|
+
/** Duplicate PriceHistory by ID. */
|
|
20
|
+
duplicatePriceHistory(originalId: string, tx?: DbAdapter): Promise<PriceHistory>;
|
|
21
|
+
/** Record price history entries */
|
|
22
|
+
recordPriceHistory(items: Array<{
|
|
23
|
+
productId: string;
|
|
24
|
+
unitCost: number;
|
|
25
|
+
supplierId?: string;
|
|
26
|
+
effectiveDate?: string;
|
|
27
|
+
}>, tx?: DbAdapter): Promise<PriceHistory[]>;
|
|
28
|
+
}
|
|
29
|
+
/** Service implementation for PriceHistory operations. */
|
|
30
|
+
export declare class PriceHistoryService implements IPriceHistoryService {
|
|
31
|
+
private context;
|
|
32
|
+
private dbAdapter;
|
|
33
|
+
private syncStore?;
|
|
34
|
+
/**
|
|
35
|
+
* Initialize PriceHistoryService.
|
|
36
|
+
* @param context - PosCore context
|
|
37
|
+
*/
|
|
38
|
+
constructor(context: PosCore);
|
|
39
|
+
/** Add new PriceHistory. */
|
|
40
|
+
addPriceHistory(data: PriceHistoryData, tx?: DbAdapter): Promise<PriceHistory>;
|
|
41
|
+
/** Update existing PriceHistory. */
|
|
42
|
+
updatePriceHistory(id: string, data: Partial<PriceHistoryData>, tx?: DbAdapter): Promise<PriceHistory>;
|
|
43
|
+
/** Get all PriceHistories with complex options. */
|
|
44
|
+
getPriceHistories(options?: QueryOptions, tx?: DbAdapter): Promise<PriceHistory[]>;
|
|
45
|
+
/** Get PriceHistory by ID or options. */
|
|
46
|
+
getPriceHistory(idOrOptions: string | QueryOptions, tx?: DbAdapter): Promise<PriceHistory | null>;
|
|
47
|
+
/** Delete PriceHistory (logical). */
|
|
48
|
+
deletePriceHistory(id: string, tx?: DbAdapter): Promise<{
|
|
49
|
+
id: string;
|
|
50
|
+
queued: boolean;
|
|
51
|
+
}>;
|
|
52
|
+
/** Duplicate PriceHistory by ID. */
|
|
53
|
+
duplicatePriceHistory(originalId: string, tx?: DbAdapter): Promise<PriceHistory>;
|
|
54
|
+
/** Record price history entries */
|
|
55
|
+
recordPriceHistory(items: Array<{
|
|
56
|
+
productId: string;
|
|
57
|
+
unitCost: number;
|
|
58
|
+
supplierId?: string;
|
|
59
|
+
effectiveDate?: string;
|
|
60
|
+
}>, tx?: DbAdapter): Promise<PriceHistory[]>;
|
|
61
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { PosCore } from '../PosCore';
|
|
2
|
+
import { DbAdapter, QueryOptions } from 'ofcore';
|
|
3
|
+
import { PriceTier, PriceTierData } from '../models/PriceTier';
|
|
4
|
+
/** Service interface for PriceTier operations. */
|
|
5
|
+
export interface IPriceTierService {
|
|
6
|
+
/** Add new PriceTier. */
|
|
7
|
+
addPriceTier(data: PriceTierData, tx?: DbAdapter): Promise<PriceTier>;
|
|
8
|
+
/** Update existing PriceTier. */
|
|
9
|
+
updatePriceTier(id: string, data: Partial<PriceTierData>): Promise<PriceTier>;
|
|
10
|
+
/** Get all PriceTiers with complex options. */
|
|
11
|
+
getPriceTiers(options?: QueryOptions, tx?: DbAdapter): Promise<PriceTier[]>;
|
|
12
|
+
/** Get PriceTier by ID or options. */
|
|
13
|
+
getPriceTier(idOrOptions: string | QueryOptions, tx?: DbAdapter): Promise<PriceTier | null>;
|
|
14
|
+
/** Delete PriceTier (logical). */
|
|
15
|
+
deletePriceTier(id: string, tx?: DbAdapter): Promise<{
|
|
16
|
+
id: string;
|
|
17
|
+
queued: boolean;
|
|
18
|
+
}>;
|
|
19
|
+
/** Duplicate PriceTier by ID. */
|
|
20
|
+
duplicatePriceTier(originalId: string, tx?: DbAdapter): Promise<PriceTier>;
|
|
21
|
+
}
|
|
22
|
+
/** Service implementation for PriceTier operations. */
|
|
23
|
+
export declare class PriceTierService implements IPriceTierService {
|
|
24
|
+
private context;
|
|
25
|
+
private dbAdapter;
|
|
26
|
+
private syncStore?;
|
|
27
|
+
/**
|
|
28
|
+
* Initialize PriceTierService.
|
|
29
|
+
* @param context - PosCore context
|
|
30
|
+
*/
|
|
31
|
+
constructor(context: PosCore);
|
|
32
|
+
/** Add new PriceTier. */
|
|
33
|
+
addPriceTier(data: PriceTierData, tx?: DbAdapter): Promise<PriceTier>;
|
|
34
|
+
/** Update existing PriceTier. */
|
|
35
|
+
updatePriceTier(id: string, data: Partial<PriceTierData>, tx?: DbAdapter): Promise<PriceTier>;
|
|
36
|
+
/** Get all PriceTiers with complex options. */
|
|
37
|
+
getPriceTiers(options?: QueryOptions, tx?: DbAdapter): Promise<PriceTier[]>;
|
|
38
|
+
/** Get PriceTier by ID or options. */
|
|
39
|
+
getPriceTier(idOrOptions: string | QueryOptions, tx?: DbAdapter): Promise<PriceTier | null>;
|
|
40
|
+
/** Delete PriceTier (logical). */
|
|
41
|
+
deletePriceTier(id: string, tx?: DbAdapter): Promise<{
|
|
42
|
+
id: string;
|
|
43
|
+
queued: boolean;
|
|
44
|
+
}>;
|
|
45
|
+
/** Duplicate PriceTier by ID. */
|
|
46
|
+
duplicatePriceTier(originalId: string, tx?: DbAdapter): Promise<PriceTier>;
|
|
47
|
+
}
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Layanan untuk menghitung harga dan diskon produk, termasuk pricing tier, konversi satuan, dan pajak.
|
|
3
|
+
*/
|
|
4
|
+
import { PosCore } from '../PosCore';
|
|
5
|
+
/**
|
|
6
|
+
* Interface untuk layanan penghitungan harga produk.
|
|
7
|
+
*/
|
|
8
|
+
export interface IPricingService {
|
|
9
|
+
/**
|
|
10
|
+
* Mendapatkan harga per unit berdasarkan tier dan satuan.
|
|
11
|
+
*
|
|
12
|
+
* @param productId ID produk
|
|
13
|
+
* @param quantity Jumlah produk yang dibeli
|
|
14
|
+
* @param customerGroupId (Opsional) ID kelompok pelanggan untuk tier khusus
|
|
15
|
+
* @param uom (Opsional) satuan produk
|
|
16
|
+
* @returns Harga per unit setelah mempertimbangkan tier dan konversi satuan
|
|
17
|
+
*/
|
|
18
|
+
getTieredPrice(productId: string, quantity: number, customerGroupId?: string, uom?: string): Promise<number>;
|
|
19
|
+
/**
|
|
20
|
+
* Menerapkan tiered pricing pada daftar item.
|
|
21
|
+
*
|
|
22
|
+
* @param items Daftar item dengan productId dan quantity
|
|
23
|
+
* @param customerGroupId (Opsional) ID kelompok pelanggan
|
|
24
|
+
* @param uom (Opsional) satuan yang digunakan
|
|
25
|
+
* @returns Daftar item dengan unitPrice yang telah dihitung
|
|
26
|
+
*/
|
|
27
|
+
applyTieredPricing(items: Array<{
|
|
28
|
+
productId: string;
|
|
29
|
+
quantity: number;
|
|
30
|
+
}>, customerGroupId?: string, uom?: string): Promise<Array<{
|
|
31
|
+
productId: string;
|
|
32
|
+
quantity: number;
|
|
33
|
+
unitPrice: number;
|
|
34
|
+
}>>;
|
|
35
|
+
/**
|
|
36
|
+
* Menghitung total diskon berdasarkan kode promosi.
|
|
37
|
+
*
|
|
38
|
+
* @param items Daftar item dengan quantity dan unitPrice
|
|
39
|
+
* @param discountCode (Opsional) kode promosi
|
|
40
|
+
* @returns Nilai diskon yang diterapkan
|
|
41
|
+
*/
|
|
42
|
+
calculatePromotionDiscount(items: Array<{
|
|
43
|
+
quantity: number;
|
|
44
|
+
unitPrice: number;
|
|
45
|
+
}>, discountCode?: string | string[]): Promise<number>;
|
|
46
|
+
/**
|
|
47
|
+
* Menghitung total pesanan, subTotal, dan diskon.
|
|
48
|
+
*
|
|
49
|
+
* @param items Daftar item dengan productId dan quantity
|
|
50
|
+
* @param discountCode (Opsional) kode promosi
|
|
51
|
+
* @param customerGroupId (Opsional) ID kelompok pelanggan
|
|
52
|
+
* @param uom (Opsional) satuan yang digunakan
|
|
53
|
+
* @returns Objek dengan items berharga, subTotal, discount, dan total
|
|
54
|
+
*/
|
|
55
|
+
calculateOrderTotal(items: Array<{
|
|
56
|
+
productId: string;
|
|
57
|
+
quantity: number;
|
|
58
|
+
}>, discountCode?: string | string[], customerGroupId?: string): Promise<{
|
|
59
|
+
items: any[];
|
|
60
|
+
subTotal: number;
|
|
61
|
+
discount: number;
|
|
62
|
+
total: number;
|
|
63
|
+
}>;
|
|
64
|
+
/**
|
|
65
|
+
* Menghitung PPN (Pajak Pertambahan Nilai).
|
|
66
|
+
*
|
|
67
|
+
* @param total Nilai total sebelum pajak
|
|
68
|
+
* @returns Nilai PPN
|
|
69
|
+
*/
|
|
70
|
+
calculatePPN(total: number): Promise<number>;
|
|
71
|
+
/**
|
|
72
|
+
* Menghitung PPH (Pajak Penghasilan).
|
|
73
|
+
*
|
|
74
|
+
* @param total Nilai total sebelum pajak
|
|
75
|
+
* @returns Nilai PPH
|
|
76
|
+
*/
|
|
77
|
+
calculatePPH(total: number): Promise<number>;
|
|
78
|
+
calculateTaxBreakdown(amount: number, options?: {
|
|
79
|
+
mode?: 'exclusive' | 'inclusive';
|
|
80
|
+
correctionAmount?: number;
|
|
81
|
+
correctionReason?: string | null;
|
|
82
|
+
}): Promise<{
|
|
83
|
+
mode: 'exclusive' | 'inclusive';
|
|
84
|
+
inputAmount: number;
|
|
85
|
+
taxBase: number;
|
|
86
|
+
ppn: number;
|
|
87
|
+
pph: number;
|
|
88
|
+
totalBeforeCorrection: number;
|
|
89
|
+
correctionAmount: number;
|
|
90
|
+
totalAfterCorrection: number;
|
|
91
|
+
correctionNote: string | null;
|
|
92
|
+
}>;
|
|
93
|
+
calculateReturnTaxImpact(amount: number, options?: {
|
|
94
|
+
mode?: 'exclusive' | 'inclusive';
|
|
95
|
+
}): Promise<{
|
|
96
|
+
mode: 'exclusive' | 'inclusive';
|
|
97
|
+
returnAmount: number;
|
|
98
|
+
taxBaseImpact: number;
|
|
99
|
+
ppnImpact: number;
|
|
100
|
+
pphImpact: number;
|
|
101
|
+
grossImpact: number;
|
|
102
|
+
}>;
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Implementasi IPricingService yang menggunakan DbAdapter dan layanan domain (pajak, satuan, promosi).
|
|
106
|
+
*/
|
|
107
|
+
export declare class PricingService implements IPricingService {
|
|
108
|
+
private context;
|
|
109
|
+
private readonly dbAdapter;
|
|
110
|
+
private readonly taxService?;
|
|
111
|
+
private readonly uomService?;
|
|
112
|
+
private readonly promotionService?;
|
|
113
|
+
/**
|
|
114
|
+
* Membuat instance PricingService.
|
|
115
|
+
*
|
|
116
|
+
* @param context Konteks PosCore yang menyediakan DbAdapter dan layanan domain
|
|
117
|
+
*/
|
|
118
|
+
constructor(context: PosCore);
|
|
119
|
+
private getRoundingIncrement;
|
|
120
|
+
private roundValue;
|
|
121
|
+
private normalizePrecision;
|
|
122
|
+
private normalizeDiscountCodes;
|
|
123
|
+
/**
|
|
124
|
+
* @inheritDoc
|
|
125
|
+
*/
|
|
126
|
+
getTieredPrice(productId: string, quantity: number, customerGroupId?: string, uom?: string): Promise<number>;
|
|
127
|
+
/**
|
|
128
|
+
* @inheritDoc
|
|
129
|
+
*/
|
|
130
|
+
applyTieredPricing(items: Array<{
|
|
131
|
+
productId: string;
|
|
132
|
+
quantity: number;
|
|
133
|
+
uomId: string;
|
|
134
|
+
}>, customerGroupId?: string): Promise<Array<{
|
|
135
|
+
productId: string;
|
|
136
|
+
quantity: number;
|
|
137
|
+
unitPrice: number;
|
|
138
|
+
}>>;
|
|
139
|
+
/**
|
|
140
|
+
* @inheritDoc
|
|
141
|
+
*/
|
|
142
|
+
calculatePromotionDiscount(items: Array<{
|
|
143
|
+
quantity: number;
|
|
144
|
+
unitPrice: number;
|
|
145
|
+
}>, discountCode?: string | string[]): Promise<number>;
|
|
146
|
+
/**
|
|
147
|
+
* @inheritDoc
|
|
148
|
+
*/
|
|
149
|
+
calculateOrderTotal(items: Array<{
|
|
150
|
+
productId: string;
|
|
151
|
+
quantity: number;
|
|
152
|
+
uomId: string;
|
|
153
|
+
}>, discountCode?: string | string[], customerGroupId?: string): Promise<{
|
|
154
|
+
items: any[];
|
|
155
|
+
subTotal: number;
|
|
156
|
+
discount: number;
|
|
157
|
+
total: number;
|
|
158
|
+
}>;
|
|
159
|
+
/**
|
|
160
|
+
* @inheritDoc
|
|
161
|
+
*/
|
|
162
|
+
calculatePPN(total: number): Promise<number>;
|
|
163
|
+
/**
|
|
164
|
+
* @inheritDoc
|
|
165
|
+
*/
|
|
166
|
+
calculatePPH(total: number): Promise<number>;
|
|
167
|
+
calculateTaxBreakdown(amount: number, options?: {
|
|
168
|
+
mode?: 'exclusive' | 'inclusive';
|
|
169
|
+
correctionAmount?: number;
|
|
170
|
+
correctionReason?: string | null;
|
|
171
|
+
}): Promise<{
|
|
172
|
+
mode: 'exclusive' | 'inclusive';
|
|
173
|
+
inputAmount: number;
|
|
174
|
+
taxBase: number;
|
|
175
|
+
ppn: number;
|
|
176
|
+
pph: number;
|
|
177
|
+
totalBeforeCorrection: number;
|
|
178
|
+
correctionAmount: number;
|
|
179
|
+
totalAfterCorrection: number;
|
|
180
|
+
correctionNote: string | null;
|
|
181
|
+
}>;
|
|
182
|
+
calculateReturnTaxImpact(amount: number, options?: {
|
|
183
|
+
mode?: 'exclusive' | 'inclusive';
|
|
184
|
+
}): Promise<{
|
|
185
|
+
mode: 'exclusive' | 'inclusive';
|
|
186
|
+
returnAmount: number;
|
|
187
|
+
taxBaseImpact: number;
|
|
188
|
+
ppnImpact: number;
|
|
189
|
+
pphImpact: number;
|
|
190
|
+
grossImpact: number;
|
|
191
|
+
}>;
|
|
192
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { PosCore } from '../PosCore';
|
|
2
|
+
import { DbAdapter, QueryOptions } from 'ofcore';
|
|
3
|
+
import { Product, ProductData } from '../models/Product';
|
|
4
|
+
/** Service interface for Product operations. */
|
|
5
|
+
export interface IProductService {
|
|
6
|
+
/** Add new Product. */
|
|
7
|
+
addProduct(data: ProductData, tx?: DbAdapter): Promise<Product>;
|
|
8
|
+
/** Update existing Product. */
|
|
9
|
+
updateProduct(id: string, data: Partial<ProductData>): Promise<Product>;
|
|
10
|
+
/** Get all Products with complex options. */
|
|
11
|
+
getProducts(options?: QueryOptions, tx?: DbAdapter): Promise<Product[]>;
|
|
12
|
+
/** Get Product by ID or options. */
|
|
13
|
+
getProduct(idOrOptions: string | QueryOptions, tx?: DbAdapter): Promise<Product | null>;
|
|
14
|
+
/** Delete Product (logical). */
|
|
15
|
+
deleteProduct(id: string, tx?: DbAdapter): Promise<{
|
|
16
|
+
id: string;
|
|
17
|
+
queued: boolean;
|
|
18
|
+
}>;
|
|
19
|
+
/** Duplicate Product by ID. */
|
|
20
|
+
duplicateProduct(originalId: string, tx?: DbAdapter): Promise<Product>;
|
|
21
|
+
/** Get Products by primary search key barcode. */
|
|
22
|
+
getProductsByBarcode(value: string, tx?: DbAdapter): Promise<Product[]>;
|
|
23
|
+
/** Get Products by primary search key qrCode. */
|
|
24
|
+
getProductsByQrCode(value: string, tx?: DbAdapter): Promise<Product[]>;
|
|
25
|
+
/** Search Product by full-text keyword. */
|
|
26
|
+
searchProducts(keyword: string, options?: QueryOptions, tx?: DbAdapter): Promise<Product[]>;
|
|
27
|
+
}
|
|
28
|
+
/** Service implementation for Product operations. */
|
|
29
|
+
export declare class ProductService implements IProductService {
|
|
30
|
+
private context;
|
|
31
|
+
private dbAdapter;
|
|
32
|
+
private syncStore?;
|
|
33
|
+
/**
|
|
34
|
+
* Initialize ProductService.
|
|
35
|
+
* @param context - PosCore context
|
|
36
|
+
*/
|
|
37
|
+
constructor(context: PosCore);
|
|
38
|
+
/** Add new Product. */
|
|
39
|
+
addProduct(data: ProductData, tx?: DbAdapter): Promise<Product>;
|
|
40
|
+
/** Update existing Product. */
|
|
41
|
+
updateProduct(id: string, data: Partial<ProductData>, tx?: DbAdapter): Promise<Product>;
|
|
42
|
+
/** Get all Products with complex options. */
|
|
43
|
+
getProducts(options?: QueryOptions, tx?: DbAdapter): Promise<Product[]>;
|
|
44
|
+
/** Get Product by ID or options. */
|
|
45
|
+
getProduct(idOrOptions: string | QueryOptions, tx?: DbAdapter): Promise<Product | null>;
|
|
46
|
+
/** Delete Product (logical). */
|
|
47
|
+
deleteProduct(id: string, tx?: DbAdapter): Promise<{
|
|
48
|
+
id: string;
|
|
49
|
+
queued: boolean;
|
|
50
|
+
}>;
|
|
51
|
+
/** Duplicate Product by ID. */
|
|
52
|
+
duplicateProduct(originalId: string, tx?: DbAdapter): Promise<Product>;
|
|
53
|
+
/** Get Products by primary search key barcode. */
|
|
54
|
+
getProductsByBarcode(value: string, tx?: DbAdapter): Promise<Product[]>;
|
|
55
|
+
/** Get Products by primary search key qrCode. */
|
|
56
|
+
getProductsByQrCode(value: string, tx?: DbAdapter): Promise<Product[]>;
|
|
57
|
+
/** Search Product by full-text keyword. */
|
|
58
|
+
searchProducts(keyword: string, options?: QueryOptions, tx?: DbAdapter): Promise<Product[]>;
|
|
59
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { PosCore } from '../PosCore';
|
|
2
|
+
import { DbAdapter, QueryOptions } from 'ofcore';
|
|
3
|
+
import { Promotion, PromotionData } from '../models/Promotion';
|
|
4
|
+
/** Service interface for Promotion operations. */
|
|
5
|
+
export interface IPromotionService {
|
|
6
|
+
/** Add new Promotion. */
|
|
7
|
+
addPromotion(data: PromotionData, tx?: DbAdapter): Promise<Promotion>;
|
|
8
|
+
/** Update existing Promotion. */
|
|
9
|
+
updatePromotion(id: string, data: Partial<PromotionData>): Promise<Promotion>;
|
|
10
|
+
/** Get all Promotions with complex options. */
|
|
11
|
+
getPromotions(options?: QueryOptions, tx?: DbAdapter): Promise<Promotion[]>;
|
|
12
|
+
/** Get Promotion by ID or options. */
|
|
13
|
+
getPromotion(idOrOptions: string | QueryOptions, tx?: DbAdapter): Promise<Promotion | null>;
|
|
14
|
+
/** Delete Promotion (logical). */
|
|
15
|
+
deletePromotion(id: string, tx?: DbAdapter): Promise<{
|
|
16
|
+
id: string;
|
|
17
|
+
queued: boolean;
|
|
18
|
+
}>;
|
|
19
|
+
/** Duplicate Promotion by ID. */
|
|
20
|
+
duplicatePromotion(originalId: string, tx?: DbAdapter): Promise<Promotion>;
|
|
21
|
+
}
|
|
22
|
+
/** Service implementation for Promotion operations. */
|
|
23
|
+
export declare class PromotionService implements IPromotionService {
|
|
24
|
+
private context;
|
|
25
|
+
private dbAdapter;
|
|
26
|
+
private syncStore?;
|
|
27
|
+
/**
|
|
28
|
+
* Initialize PromotionService.
|
|
29
|
+
* @param context - PosCore context
|
|
30
|
+
*/
|
|
31
|
+
constructor(context: PosCore);
|
|
32
|
+
/** Add new Promotion. */
|
|
33
|
+
addPromotion(data: PromotionData, tx?: DbAdapter): Promise<Promotion>;
|
|
34
|
+
/** Update existing Promotion. */
|
|
35
|
+
updatePromotion(id: string, data: Partial<PromotionData>, tx?: DbAdapter): Promise<Promotion>;
|
|
36
|
+
/** Get all Promotions with complex options. */
|
|
37
|
+
getPromotions(options?: QueryOptions, tx?: DbAdapter): Promise<Promotion[]>;
|
|
38
|
+
/** Get Promotion by ID or options. */
|
|
39
|
+
getPromotion(idOrOptions: string | QueryOptions, tx?: DbAdapter): Promise<Promotion | null>;
|
|
40
|
+
/** Delete Promotion (logical). */
|
|
41
|
+
deletePromotion(id: string, tx?: DbAdapter): Promise<{
|
|
42
|
+
id: string;
|
|
43
|
+
queued: boolean;
|
|
44
|
+
}>;
|
|
45
|
+
/** Duplicate Promotion by ID. */
|
|
46
|
+
duplicatePromotion(originalId: string, tx?: DbAdapter): Promise<Promotion>;
|
|
47
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { PosCore } from '../PosCore';
|
|
2
|
+
import { DbAdapter, QueryOptions } from 'ofcore';
|
|
3
|
+
import { PurchaseItem, PurchaseItemData } from '../models/PurchaseItem';
|
|
4
|
+
/** Service interface for PurchaseItem operations. */
|
|
5
|
+
export interface IPurchaseItemService {
|
|
6
|
+
/** Add new PurchaseItem. */
|
|
7
|
+
addPurchaseItem(data: PurchaseItemData, tx?: DbAdapter): Promise<PurchaseItem>;
|
|
8
|
+
/** Update existing PurchaseItem. */
|
|
9
|
+
updatePurchaseItem(id: string, data: Partial<PurchaseItemData>): Promise<PurchaseItem>;
|
|
10
|
+
/** Get all PurchaseItems with complex options. */
|
|
11
|
+
getPurchaseItems(options?: QueryOptions, tx?: DbAdapter): Promise<PurchaseItem[]>;
|
|
12
|
+
/** Get PurchaseItem by ID or options. */
|
|
13
|
+
getPurchaseItem(idOrOptions: string | QueryOptions, tx?: DbAdapter): Promise<PurchaseItem | null>;
|
|
14
|
+
/** Delete PurchaseItem (logical). */
|
|
15
|
+
deletePurchaseItem(id: string, tx?: DbAdapter): Promise<{
|
|
16
|
+
id: string;
|
|
17
|
+
queued: boolean;
|
|
18
|
+
}>;
|
|
19
|
+
/** Duplicate PurchaseItem by ID. */
|
|
20
|
+
duplicatePurchaseItem(originalId: string, tx?: DbAdapter): Promise<PurchaseItem>;
|
|
21
|
+
}
|
|
22
|
+
/** Service implementation for PurchaseItem operations. */
|
|
23
|
+
export declare class PurchaseItemService implements IPurchaseItemService {
|
|
24
|
+
private context;
|
|
25
|
+
private dbAdapter;
|
|
26
|
+
private syncStore?;
|
|
27
|
+
/**
|
|
28
|
+
* Initialize PurchaseItemService.
|
|
29
|
+
* @param context - PosCore context
|
|
30
|
+
*/
|
|
31
|
+
constructor(context: PosCore);
|
|
32
|
+
/** Add new PurchaseItem. */
|
|
33
|
+
addPurchaseItem(data: PurchaseItemData, tx?: DbAdapter): Promise<PurchaseItem>;
|
|
34
|
+
/** Update existing PurchaseItem. */
|
|
35
|
+
updatePurchaseItem(id: string, data: Partial<PurchaseItemData>, tx?: DbAdapter): Promise<PurchaseItem>;
|
|
36
|
+
/** Get all PurchaseItems with complex options. */
|
|
37
|
+
getPurchaseItems(options?: QueryOptions, tx?: DbAdapter): Promise<PurchaseItem[]>;
|
|
38
|
+
/** Get PurchaseItem by ID or options. */
|
|
39
|
+
getPurchaseItem(idOrOptions: string | QueryOptions, tx?: DbAdapter): Promise<PurchaseItem | null>;
|
|
40
|
+
/** Delete PurchaseItem (logical). */
|
|
41
|
+
deletePurchaseItem(id: string, tx?: DbAdapter): Promise<{
|
|
42
|
+
id: string;
|
|
43
|
+
queued: boolean;
|
|
44
|
+
}>;
|
|
45
|
+
/** Duplicate PurchaseItem by ID. */
|
|
46
|
+
duplicatePurchaseItem(originalId: string, tx?: DbAdapter): Promise<PurchaseItem>;
|
|
47
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { PosCore } from '../PosCore';
|
|
2
|
+
import { DbAdapter, QueryOptions } from 'ofcore';
|
|
3
|
+
import { PurchaseOrderItem, PurchaseOrderItemData } from '../models/PurchaseOrderItem';
|
|
4
|
+
/** Service interface for PurchaseOrderItem operations. */
|
|
5
|
+
export interface IPurchaseOrderItemService {
|
|
6
|
+
/** Add new PurchaseOrderItem. */
|
|
7
|
+
addPurchaseOrderItem(data: PurchaseOrderItemData, tx?: DbAdapter): Promise<PurchaseOrderItem>;
|
|
8
|
+
/** Update existing PurchaseOrderItem. */
|
|
9
|
+
updatePurchaseOrderItem(id: string, data: Partial<PurchaseOrderItemData>): Promise<PurchaseOrderItem>;
|
|
10
|
+
/** Get all PurchaseOrderItems with complex options. */
|
|
11
|
+
getPurchaseOrderItems(options?: QueryOptions, tx?: DbAdapter): Promise<PurchaseOrderItem[]>;
|
|
12
|
+
/** Get PurchaseOrderItem by ID or options. */
|
|
13
|
+
getPurchaseOrderItem(idOrOptions: string | QueryOptions, tx?: DbAdapter): Promise<PurchaseOrderItem | null>;
|
|
14
|
+
/** Delete PurchaseOrderItem (logical). */
|
|
15
|
+
deletePurchaseOrderItem(id: string, tx?: DbAdapter): Promise<{
|
|
16
|
+
id: string;
|
|
17
|
+
queued: boolean;
|
|
18
|
+
}>;
|
|
19
|
+
/** Duplicate PurchaseOrderItem by ID. */
|
|
20
|
+
duplicatePurchaseOrderItem(originalId: string, tx?: DbAdapter): Promise<PurchaseOrderItem>;
|
|
21
|
+
}
|
|
22
|
+
/** Service implementation for PurchaseOrderItem operations. */
|
|
23
|
+
export declare class PurchaseOrderItemService implements IPurchaseOrderItemService {
|
|
24
|
+
private context;
|
|
25
|
+
private dbAdapter;
|
|
26
|
+
private syncStore?;
|
|
27
|
+
/**
|
|
28
|
+
* Initialize PurchaseOrderItemService.
|
|
29
|
+
* @param context - PosCore context
|
|
30
|
+
*/
|
|
31
|
+
constructor(context: PosCore);
|
|
32
|
+
/** Add new PurchaseOrderItem. */
|
|
33
|
+
addPurchaseOrderItem(data: PurchaseOrderItemData, tx?: DbAdapter): Promise<PurchaseOrderItem>;
|
|
34
|
+
/** Update existing PurchaseOrderItem. */
|
|
35
|
+
updatePurchaseOrderItem(id: string, data: Partial<PurchaseOrderItemData>, tx?: DbAdapter): Promise<PurchaseOrderItem>;
|
|
36
|
+
/** Get all PurchaseOrderItems with complex options. */
|
|
37
|
+
getPurchaseOrderItems(options?: QueryOptions, tx?: DbAdapter): Promise<PurchaseOrderItem[]>;
|
|
38
|
+
/** Get PurchaseOrderItem by ID or options. */
|
|
39
|
+
getPurchaseOrderItem(idOrOptions: string | QueryOptions, tx?: DbAdapter): Promise<PurchaseOrderItem | null>;
|
|
40
|
+
/** Delete PurchaseOrderItem (logical). */
|
|
41
|
+
deletePurchaseOrderItem(id: string, tx?: DbAdapter): Promise<{
|
|
42
|
+
id: string;
|
|
43
|
+
queued: boolean;
|
|
44
|
+
}>;
|
|
45
|
+
/** Duplicate PurchaseOrderItem by ID. */
|
|
46
|
+
duplicatePurchaseOrderItem(originalId: string, tx?: DbAdapter): Promise<PurchaseOrderItem>;
|
|
47
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { PosCore } from '../PosCore';
|
|
2
|
+
import { DbAdapter, QueryOptions } from 'ofcore';
|
|
3
|
+
import { PurchaseOrder, PurchaseOrderData } from '../models/PurchaseOrder';
|
|
4
|
+
/** Service interface for PurchaseOrder operations. */
|
|
5
|
+
export interface IPurchaseOrderService {
|
|
6
|
+
/** Add new PurchaseOrder. */
|
|
7
|
+
addPurchaseOrder(data: PurchaseOrderData, tx?: DbAdapter): Promise<PurchaseOrder>;
|
|
8
|
+
/** Update existing PurchaseOrder. */
|
|
9
|
+
updatePurchaseOrder(id: string, data: Partial<PurchaseOrderData>): Promise<PurchaseOrder>;
|
|
10
|
+
/** Get all PurchaseOrders with complex options. */
|
|
11
|
+
getPurchaseOrders(options?: QueryOptions, tx?: DbAdapter): Promise<PurchaseOrder[]>;
|
|
12
|
+
/** Get PurchaseOrder by ID or options. */
|
|
13
|
+
getPurchaseOrder(idOrOptions: string | QueryOptions, tx?: DbAdapter): Promise<PurchaseOrder | null>;
|
|
14
|
+
/** Delete PurchaseOrder (logical). */
|
|
15
|
+
deletePurchaseOrder(id: string, tx?: DbAdapter): Promise<{
|
|
16
|
+
id: string;
|
|
17
|
+
queued: boolean;
|
|
18
|
+
}>;
|
|
19
|
+
/** Duplicate PurchaseOrder by ID. */
|
|
20
|
+
duplicatePurchaseOrder(originalId: string, tx?: DbAdapter): Promise<PurchaseOrder>;
|
|
21
|
+
}
|
|
22
|
+
/** Service implementation for PurchaseOrder operations. */
|
|
23
|
+
export declare class PurchaseOrderService implements IPurchaseOrderService {
|
|
24
|
+
private context;
|
|
25
|
+
private dbAdapter;
|
|
26
|
+
private syncStore?;
|
|
27
|
+
/**
|
|
28
|
+
* Initialize PurchaseOrderService.
|
|
29
|
+
* @param context - PosCore context
|
|
30
|
+
*/
|
|
31
|
+
constructor(context: PosCore);
|
|
32
|
+
/** Add new PurchaseOrder. */
|
|
33
|
+
addPurchaseOrder(data: PurchaseOrderData, tx?: DbAdapter): Promise<PurchaseOrder>;
|
|
34
|
+
/** Update existing PurchaseOrder. */
|
|
35
|
+
updatePurchaseOrder(id: string, data: Partial<PurchaseOrderData>, tx?: DbAdapter): Promise<PurchaseOrder>;
|
|
36
|
+
/** Get all PurchaseOrders with complex options. */
|
|
37
|
+
getPurchaseOrders(options?: QueryOptions, tx?: DbAdapter): Promise<PurchaseOrder[]>;
|
|
38
|
+
/** Get PurchaseOrder by ID or options. */
|
|
39
|
+
getPurchaseOrder(idOrOptions: string | QueryOptions, tx?: DbAdapter): Promise<PurchaseOrder | null>;
|
|
40
|
+
/** Delete PurchaseOrder (logical). */
|
|
41
|
+
deletePurchaseOrder(id: string, tx?: DbAdapter): Promise<{
|
|
42
|
+
id: string;
|
|
43
|
+
queued: boolean;
|
|
44
|
+
}>;
|
|
45
|
+
/** Duplicate PurchaseOrder by ID. */
|
|
46
|
+
duplicatePurchaseOrder(originalId: string, tx?: DbAdapter): Promise<PurchaseOrder>;
|
|
47
|
+
}
|