ionic-vhframeworks 4.3.9 → 4.4.3
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/bundles/ionic-vhframeworks.umd.js +1 -1
- package/bundles/ionic-vhframeworks.umd.js.map +1 -1
- package/bundles/ionic-vhframeworks.umd.min.js +1 -1
- package/bundles/ionic-vhframeworks.umd.min.js.map +1 -1
- package/fesm2015/ionic-vhframeworks.js.map +1 -1
- package/ionic-vhframeworks.metadata.json +1 -1
- package/lib/ionic-vhframeworks.service.d.ts +1747 -105
- package/package.json +1 -1
|
@@ -1173,6 +1173,7 @@ export declare class VhQueryCafe {
|
|
|
1173
1173
|
private promotions;
|
|
1174
1174
|
private patternmenus;
|
|
1175
1175
|
private printers;
|
|
1176
|
+
private print_pages;
|
|
1176
1177
|
private discount_bills;
|
|
1177
1178
|
private discount_saless;
|
|
1178
1179
|
private customer_classs;
|
|
@@ -1212,6 +1213,14 @@ export declare class VhQueryCafe {
|
|
|
1212
1213
|
*/
|
|
1213
1214
|
constructor(vhmongo_firebase: Vhmongo_firebase, vhQuery: VhQuery, vhAuth: VhAuth, vhAlgorithm: VhAlgorithm);
|
|
1214
1215
|
/**
|
|
1216
|
+
* Hàm này lấy về các trường trong phạm vi quản lý bán hàng trong cài đặt
|
|
1217
|
+
* @example:
|
|
1218
|
+
* let branch_management_scope = this.vhQueryCafe.getBranch_Management_Scope();
|
|
1219
|
+
* @return Object = {product_scope, employee_scope, customer_scope, supplier_scope, cafe_program_scope}
|
|
1220
|
+
* => true áp dụng cho toàn chi nhánh, false áp dụng riêng cho từng chi nhánh
|
|
1221
|
+
*/
|
|
1222
|
+
getBranch_Management_Scope(): any;
|
|
1223
|
+
/**
|
|
1215
1224
|
* @description: hàm này lấy về những hạn chế của gói main_package (khách trả phí mua gói sử dụng các chức năng CHÍNH, mỗi gói sẽ có nhưng hạn chế khác nhau về user_number, show_report_duration)
|
|
1216
1225
|
* @example
|
|
1217
1226
|
* this.vhQueryCafe.refreshLocalRestrictionMainPackage()
|
|
@@ -3354,6 +3363,207 @@ export declare class VhQueryCafe {
|
|
|
3354
3363
|
* @return array(object) = [{},{},..]
|
|
3355
3364
|
*/
|
|
3356
3365
|
getPrinters(): Promise<unknown>;
|
|
3366
|
+
/**
|
|
3367
|
+
* @example:
|
|
3368
|
+
* this.vhQueryCafe.refreshLocalPrintPages()
|
|
3369
|
+
.then(()=>{
|
|
3370
|
+
do something.....
|
|
3371
|
+
})
|
|
3372
|
+
* Hàm này refresh giá trị mới nhất cho hàm getlocalPrintPage(), getlocalPrintPages() trong localstorage
|
|
3373
|
+
* @return Promise => null
|
|
3374
|
+
*/
|
|
3375
|
+
private refreshLocalPrintPages;
|
|
3376
|
+
/**
|
|
3377
|
+
* @example:
|
|
3378
|
+
* let print_page = this.vhQueryCafe.getLocalPrintPage('page_desktop_sales');
|
|
3379
|
+
* @param print_page_type
|
|
3380
|
+
* @return Object => obj = {} or null
|
|
3381
|
+
*/
|
|
3382
|
+
getLocalPrintPage(print_page_type: string): any;
|
|
3383
|
+
/**
|
|
3384
|
+
* @example:
|
|
3385
|
+
* let pagesize = this.vhQueryCafe.getLocalDefaultPageSize('page_desktop_sales');
|
|
3386
|
+
* @param print_page_type
|
|
3387
|
+
* @return Object => obj = {} or null
|
|
3388
|
+
*/
|
|
3389
|
+
getLocalDefaultPageSize(print_page_type: string): any;
|
|
3390
|
+
/**
|
|
3391
|
+
* @example:
|
|
3392
|
+
* this.vhQueryCafe.addPrintPage('page_desktop_sales', {name:'camera 2', quantity:20, price:200000})
|
|
3393
|
+
.then((print_page)=>{
|
|
3394
|
+
console.log('addPrintPage', print_page);
|
|
3395
|
+
}, error=>{
|
|
3396
|
+
console.log('error', error);
|
|
3397
|
+
})
|
|
3398
|
+
* @param data
|
|
3399
|
+
* Promise => object = {} Luu ý: chỉ có 2 trường hợp, hoặc là thêm thành công, hoặc là báo lỗi error
|
|
3400
|
+
*/
|
|
3401
|
+
addPrintPage(print_page_type: string, data: any): Promise<unknown>;
|
|
3402
|
+
/**
|
|
3403
|
+
* @example:
|
|
3404
|
+
* this.vhQueryCafe.updatePrintPage('5fb6780ca2148e09806c5b01', {quantity:400})
|
|
3405
|
+
.then((bool)=>{
|
|
3406
|
+
console.log('updatePrintPage', bool);
|
|
3407
|
+
}, error=>{
|
|
3408
|
+
console.log('error', error);
|
|
3409
|
+
})
|
|
3410
|
+
* @param id_print_page
|
|
3411
|
+
* @param data
|
|
3412
|
+
* @return Promise => bool = true or false
|
|
3413
|
+
*/
|
|
3414
|
+
updatePrintPage(id_print_page: string, data: object): Promise<unknown>;
|
|
3415
|
+
/**
|
|
3416
|
+
* @example:
|
|
3417
|
+
* this.vhQueryCafe.deletePrintPage('5fb67fda87c0f21d484cbdf3')
|
|
3418
|
+
.then((bool)=>{
|
|
3419
|
+
console.log('deletePrintPage', bool);
|
|
3420
|
+
})
|
|
3421
|
+
* @param id_print_page
|
|
3422
|
+
* @return Promise => bool = true or false
|
|
3423
|
+
*/
|
|
3424
|
+
deletePrintPage(id_print_page: string): Promise<unknown>;
|
|
3425
|
+
/**
|
|
3426
|
+
* @example
|
|
3427
|
+
* this.vhQueryCafe.getPrintPages()
|
|
3428
|
+
.then((print_pages)=>{
|
|
3429
|
+
console.log('getPrintPages', print_pages);
|
|
3430
|
+
})
|
|
3431
|
+
* @return array(object) = [{},{},..]
|
|
3432
|
+
*/
|
|
3433
|
+
getPrintPages(): Promise<unknown>;
|
|
3434
|
+
/**
|
|
3435
|
+
* Hàm này dùng để thực hiện trừ hàng hóa trong nhiều Payment_Card
|
|
3436
|
+
* Hàm chạy ổn định anh sẽ thêm phần trừ số lượng hàng hóa đã sử dụng trong payment_card_code
|
|
3437
|
+
* @example
|
|
3438
|
+
let bill = {
|
|
3439
|
+
bill_type: 51,
|
|
3440
|
+
id_employee: '2rVieBQTubQ2hjUnpwU4w7qSlD83',
|
|
3441
|
+
id_branch: 'ADGNX9HFzffJ59yRtqNd',
|
|
3442
|
+
id_customer: 'cus001',
|
|
3443
|
+
id_wallet: 'wallet001',
|
|
3444
|
+
note: '',
|
|
3445
|
+
date: new Date(),
|
|
3446
|
+
bill_code: 'L46K0502'
|
|
3447
|
+
}
|
|
3448
|
+
let bill_details =[{
|
|
3449
|
+
id_payment_card: '7Q5BZVRlyySrhShngMDv',
|
|
3450
|
+
id_payment_card_code: '33cTgnd2xZo3OW9tsu1d',
|
|
3451
|
+
pctype: 1,
|
|
3452
|
+
products:[{
|
|
3453
|
+
id_product:'9tg6UxzK26DDVEVHsvq5'
|
|
3454
|
+
quantity: 5
|
|
3455
|
+
price: 100000
|
|
3456
|
+
ptype: 1,
|
|
3457
|
+
unit: 'cái',
|
|
3458
|
+
ratio:1
|
|
3459
|
+
},{
|
|
3460
|
+
id_product:'jUqd5bE6y2JhX0aCd5TF',
|
|
3461
|
+
quantity: 1
|
|
3462
|
+
price: 50000
|
|
3463
|
+
ptype: 2,
|
|
3464
|
+
unit: 'cái',
|
|
3465
|
+
ratio:1
|
|
3466
|
+
},{
|
|
3467
|
+
id_product,
|
|
3468
|
+
quantity,
|
|
3469
|
+
price,
|
|
3470
|
+
ptype: 1,
|
|
3471
|
+
unit: 'cái',
|
|
3472
|
+
ratio:1
|
|
3473
|
+
}]
|
|
3474
|
+
//dưới là cái cũ, sẽ bỏ đi
|
|
3475
|
+
let bill_details =[{
|
|
3476
|
+
id_payment_card: '7Q5BZVRlyySrhShngMDv',
|
|
3477
|
+
id_payment_card_code: '33cTgnd2xZo3OW9tsu1d',
|
|
3478
|
+
pctype: 1,
|
|
3479
|
+
id_product:'9tg6UxzK26DDVEVHsvq5'
|
|
3480
|
+
quantity: 2
|
|
3481
|
+
price: 200000
|
|
3482
|
+
ptype: 1
|
|
3483
|
+
},{
|
|
3484
|
+
id_payment_card: '7Q5BZVRlyySrhShngMDv',
|
|
3485
|
+
id_payment_card_code: '33cTgnd2xZo3OW9tsu1d',
|
|
3486
|
+
pctype: 1,
|
|
3487
|
+
id_product:'jUqd5bE6y2JhX0aCd5TF',
|
|
3488
|
+
quantity: 1
|
|
3489
|
+
price: 100000
|
|
3490
|
+
ptype: 2
|
|
3491
|
+
}]
|
|
3492
|
+
this.vhQueryCafe.createBill_Billdetail_51(bill, bill_details)
|
|
3493
|
+
.then((bill:any)=>{
|
|
3494
|
+
console.log(bill._id);
|
|
3495
|
+
},(error:any)=>{
|
|
3496
|
+
console.log('error ', error);
|
|
3497
|
+
})
|
|
3498
|
+
* @param bill
|
|
3499
|
+
* @param bill_details
|
|
3500
|
+
* @returns Promise => object = {} or null
|
|
3501
|
+
*/
|
|
3502
|
+
createBill_Billdetail_51(bill: any, bill_details: any): any;
|
|
3503
|
+
/**
|
|
3504
|
+
* Hàm này dùng để thực hiện đổi voucher lấy hàng hóa
|
|
3505
|
+
* @example
|
|
3506
|
+
let bill = {
|
|
3507
|
+
bill_type: 41,
|
|
3508
|
+
id_employee: '2rVieBQTubQ2hjUnpwU4w7qSlD83',
|
|
3509
|
+
id_branch: '2rVieBQTubQ2hjUnpwU4w7qSlD83',
|
|
3510
|
+
id_customer: 'cus001',
|
|
3511
|
+
id_wallet: 'wallet001',
|
|
3512
|
+
note: '',
|
|
3513
|
+
date: new Date(),
|
|
3514
|
+
bill_code: ''
|
|
3515
|
+
}
|
|
3516
|
+
let bill_details =[{
|
|
3517
|
+
id_voucher: 'voucher006',
|
|
3518
|
+
id_voucher_code: 'MHRD9N0531',
|
|
3519
|
+
vtype: 1,
|
|
3520
|
+
quantity: 2//bỏ đi
|
|
3521
|
+
products:[{
|
|
3522
|
+
id_product:'9tg6UxzK26DDVEVHsvq5'
|
|
3523
|
+
quantity: 5
|
|
3524
|
+
price: 100000
|
|
3525
|
+
ptype: 1,
|
|
3526
|
+
unit: 'cái',
|
|
3527
|
+
ratio:1
|
|
3528
|
+
},{
|
|
3529
|
+
id_product:'jUqd5bE6y2JhX0aCd5TF',
|
|
3530
|
+
quantity: 1
|
|
3531
|
+
price: 50000
|
|
3532
|
+
ptype: 2,
|
|
3533
|
+
unit: 'cái',
|
|
3534
|
+
ratio:1
|
|
3535
|
+
},{
|
|
3536
|
+
id_product,
|
|
3537
|
+
quantity,
|
|
3538
|
+
price,
|
|
3539
|
+
ptype: 5// bây giờ phần mềm chưa dùng voucher có combo
|
|
3540
|
+
combos:[{
|
|
3541
|
+
id_product,
|
|
3542
|
+
quantity,
|
|
3543
|
+
price,
|
|
3544
|
+
ptype: 1,
|
|
3545
|
+
unit: 'cái',
|
|
3546
|
+
ratio:1
|
|
3547
|
+
},{
|
|
3548
|
+
id_product,
|
|
3549
|
+
quantity,
|
|
3550
|
+
price,
|
|
3551
|
+
ptype: 2,
|
|
3552
|
+
unit: 'cái',
|
|
3553
|
+
ratio:1
|
|
3554
|
+
}]
|
|
3555
|
+
}]
|
|
3556
|
+
this.vhQueryCafe.createBill_Billdetail_41(bill, bill_details)
|
|
3557
|
+
.then((bill:any)=>{
|
|
3558
|
+
console.log(bill._id);
|
|
3559
|
+
},(error:any)=>{
|
|
3560
|
+
console.log('error ', error);
|
|
3561
|
+
})
|
|
3562
|
+
* @param bill
|
|
3563
|
+
* @param bill_details
|
|
3564
|
+
* @returns Promise => object = {} or null
|
|
3565
|
+
*/
|
|
3566
|
+
createBill_Billdetail_41(bill: any, bill_details: any): any;
|
|
3357
3567
|
/**
|
|
3358
3568
|
* Hàm này dùng cho những bill nào được tao ra thêm bill_detail vào và lưu lên database luôn
|
|
3359
3569
|
* @example
|
|
@@ -4162,7 +4372,7 @@ export declare class VhQueryCafe {
|
|
|
4162
4372
|
*/
|
|
4163
4373
|
deleteAppSettingNameBranch(appsetting_name: any): Promise<unknown>;
|
|
4164
4374
|
/**
|
|
4165
|
-
* @Usage : Hàm này lấy về tiền chiết khấu trên tổng giá trị hàng hóa bán ra của mỗi đơn hàng theo khách mua hàng
|
|
4375
|
+
* @Usage : Hàm này lấy về tiền chiết khấu trên tổng giá trị hàng hóa bán ra của mỗi đơn hàng theo hạng khách mua hàng
|
|
4166
4376
|
* @example :
|
|
4167
4377
|
* let discount = this.vhQueryCafe.getDiscount_bill_byCustomer(43000000, '7YLcm0cFKLu2KaQQ8cyv');
|
|
4168
4378
|
* @param total_price : Tổng giá
|
|
@@ -4171,7 +4381,6 @@ export declare class VhQueryCafe {
|
|
|
4171
4381
|
* trả về null nghĩa là khách hàng này không có chiết khấu theo hóa đơn
|
|
4172
4382
|
*/
|
|
4173
4383
|
getDiscount_bill_byCustomer(total_price: number, id_customer: any): any;
|
|
4174
|
-
getDiscount_bill_byCustomer_new(total_price: number, id_customer: any): any;
|
|
4175
4384
|
/**
|
|
4176
4385
|
* @Usage :Hàm này dùng trong page CHIẾT KHẤU KHÁCH HÀNG -> Chọn TẤT CẢ hoặc MỘT khách hàng
|
|
4177
4386
|
* @notice : Mỗi công thức chiết khấu có 5 mức (level1, level2, level3, level4, level5), giá trị doanh số (sales) level sau phải lơn hơn level trước
|
|
@@ -4193,9 +4402,8 @@ export declare class VhQueryCafe {
|
|
|
4193
4402
|
* @return Promise JSON(array) => json.docs = [obj, obj, obj....]; obj ={index, name, img, discount_name,sales_btax, discount_btax, sales_atax, discount_atax}
|
|
4194
4403
|
*/
|
|
4195
4404
|
getReportDiscount_sales_Customers(starttime: any, endtime: any, IDcustomer: any, IDbranch?: string): Promise<any>;
|
|
4196
|
-
getReportDiscount_sales_Customers_new(starttime: any, endtime: any, IDcustomer: any, IDbranch?: string): Promise<any>;
|
|
4197
4405
|
/**
|
|
4198
|
-
* @Usage :Hàm này dùng trong page HOA HỒNG NHÂN VIÊN -> Chọn TẤT CẢ hoặc MỘT nhân viên
|
|
4406
|
+
* @Usage :Hàm này dùng trong page HOA HỒNG hạng NHÂN VIÊN -> Chọn TẤT CẢ hoặc MỘT nhân viên
|
|
4199
4407
|
* @notice : Mỗi công thức chiết khấu có 5 mức (level1, level2, level3, level4, level5), giá trị doanh số (sales) level sau phải lơn hơn level trước
|
|
4200
4408
|
* type : 1 chiết khấu %, 2 chiết khấu tiền
|
|
4201
4409
|
* method : 1 phương pháp tính theo từng mức, 2 phương pháp tính theo mức cuối
|
|
@@ -4214,7 +4422,6 @@ export declare class VhQueryCafe {
|
|
|
4214
4422
|
* @return Promise JSON(array) => json.docs = [obj, obj, obj....]; obj ={index, name, img, commission_name, sales_btax, commission_btax, sales_atax, commission_atax}
|
|
4215
4423
|
*/
|
|
4216
4424
|
getReportCommission_Employees(starttime: any, endtime: any, IDemployee: any, IDbranch?: string): Promise<any>;
|
|
4217
|
-
getReportCommission_Employees_new(starttime: any, endtime: any, IDemployee: any, IDbranch?: string): Promise<any>;
|
|
4218
4425
|
/**
|
|
4219
4426
|
* VhQueryCafe:
|
|
4220
4427
|
* cashbook_first: tiền mặt đầu kỳ (starttime),
|
|
@@ -4811,118 +5018,1550 @@ export declare class VhQueryCafe {
|
|
|
4811
5018
|
*/
|
|
4812
5019
|
getReportSales_byHoursOut_hourArray(starttime: any, endtime: any, hour_array: any, IDbranch?: string): Promise<any>;
|
|
4813
5020
|
/**
|
|
4814
|
-
* @example:
|
|
4815
|
-
* let day_array: Array<any> = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31];
|
|
4816
|
-
* let endtime = new Date();
|
|
4817
|
-
let starttime = new Date('2020-07-01T05:24:00');
|
|
4818
|
-
this.vhQueryCafe.getReportSales_byDaysOut_dayArray(starttime, endtime, day_array)
|
|
4819
|
-
.then((reportSales)=>{
|
|
4820
|
-
console.log('reportSales', reportSales);
|
|
4821
|
-
console.log('reportSales.docs[0]', reportSales.docs[0]);
|
|
5021
|
+
* @example:
|
|
5022
|
+
* let day_array: Array<any> = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31];
|
|
5023
|
+
* let endtime = new Date();
|
|
5024
|
+
let starttime = new Date('2020-07-01T05:24:00');
|
|
5025
|
+
this.vhQueryCafe.getReportSales_byDaysOut_dayArray(starttime, endtime, day_array)
|
|
5026
|
+
.then((reportSales)=>{
|
|
5027
|
+
console.log('reportSales', reportSales);
|
|
5028
|
+
console.log('reportSales.docs[0]', reportSales.docs[0]);
|
|
5029
|
+
})
|
|
5030
|
+
* @param starttime
|
|
5031
|
+
* @param endtime
|
|
5032
|
+
* @param hour_array
|
|
5033
|
+
* @param IDbranch : 'all' or id_branch
|
|
5034
|
+
*/
|
|
5035
|
+
getReportSales_byDaysOut_dayArray(starttime: any, endtime: any, day_array: any, IDbranch?: string): Promise<any>;
|
|
5036
|
+
/**
|
|
5037
|
+
* lấy về mảng json.docs(array) doanh số theo 12 tháng trong năm
|
|
5038
|
+
* @example:
|
|
5039
|
+
* let month_array: Array<any> = [0,1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11];
|
|
5040
|
+
* let endtime = new Date();
|
|
5041
|
+
let starttime = new Date('2020-07-01T05:24:00');
|
|
5042
|
+
this.vhQueryCafe.getReportSales_byMonthsOut_monthArray(starttime, endtime, month_array)
|
|
5043
|
+
.then((reportSales)=>{
|
|
5044
|
+
console.log('reportSales', reportSales);
|
|
5045
|
+
console.log('reportSales.docs[0]', reportSales.docs[0]);
|
|
5046
|
+
})
|
|
5047
|
+
* @param starttime
|
|
5048
|
+
* @param endtime
|
|
5049
|
+
* @param hour_array
|
|
5050
|
+
* @param IDbranch : 'all' or id_branch
|
|
5051
|
+
*/
|
|
5052
|
+
getReportSales_byMonthsOut_monthArray(starttime: any, endtime: any, month_array: any, IDbranch?: string): Promise<any>;
|
|
5053
|
+
/**
|
|
5054
|
+
* lấy về mảng json.docs(array) doanh số theo một hoặc tất cả các chi nhánh
|
|
5055
|
+
* @example:
|
|
5056
|
+
this.vhQueryCafe.getReportSales_byIDbranch(starttime, endtime, 'fda3s2fd1a3sgghdfg1h')
|
|
5057
|
+
.then((reportSales)=>{
|
|
5058
|
+
console.log('reportSales', reportSales);
|
|
5059
|
+
console.log('reportSales.docs[0]', reportSales.docs[0]);
|
|
5060
|
+
})
|
|
5061
|
+
* @param starttime
|
|
5062
|
+
* @param endtime
|
|
5063
|
+
* @param IDbranch : 'all' or id_branch
|
|
5064
|
+
* @return :
|
|
5065
|
+
* json = {docs(array), empty(boolean), size(number), sales_btax(number), sales_atax(number)}
|
|
5066
|
+
* trong đó docs = [{name(string), id_branch(string), sales_btax(number), sales_atax(number)}]
|
|
5067
|
+
*/
|
|
5068
|
+
getReportSales_byIDbranch(starttime: any, endtime: any, IDbranch?: string): Promise<any>;
|
|
5069
|
+
/**
|
|
5070
|
+
* @Usage Hàm này dùng trong page SẢN PHẨM CÓ DOANH SỐ BÁN GIẢM DẦN
|
|
5071
|
+
* @example
|
|
5072
|
+
* let endtime = new Date();
|
|
5073
|
+
let starttime = new Date('2020-07-01T05:24:00');
|
|
5074
|
+
this.vhQueryCafe.getReportSales_Products_byTime_DESC(starttime, endtime)
|
|
5075
|
+
.then((reportsales)=>{
|
|
5076
|
+
console.log('reportsales', reportsales);
|
|
5077
|
+
console.log('reportsales.docs[0]', reportsales.docs[0]);
|
|
5078
|
+
})
|
|
5079
|
+
* @param starttime
|
|
5080
|
+
* @param endtime
|
|
5081
|
+
* @return Promise JSON(array) => json.docs = [obj, obj, obj....]; obj ={index, name, barcode, unit, img, quantity, sales_btax, sales_atax}
|
|
5082
|
+
*/
|
|
5083
|
+
getReportSales_Products_byTime_DESC(starttime: any, endtime: any): Promise<any>;
|
|
5084
|
+
/**
|
|
5085
|
+
* @Usage Hàm này dùng trong page DANH MỤC CÓ DOANH SỐ BÁN GIẢM DẦN
|
|
5086
|
+
* @example
|
|
5087
|
+
* let endtime = new Date();
|
|
5088
|
+
let starttime = new Date('2020-07-01T05:24:00');
|
|
5089
|
+
this.vhQueryCafe.getReportSales_Categorys_byTime_DESC(starttime, endtime)
|
|
5090
|
+
.then((reportsales)=>{
|
|
5091
|
+
console.log('reportsales', reportsales);
|
|
5092
|
+
console.log('reportsales.docs[0]', reportsales.docs[0]);
|
|
5093
|
+
})
|
|
5094
|
+
* @param starttime
|
|
5095
|
+
* @param endtime
|
|
5096
|
+
* @return Promise JSON(array) => json.docs = [obj, obj, obj....]; obj ={index, name, id_category, quantity, sales_btax, sales_atax}
|
|
5097
|
+
*/
|
|
5098
|
+
getReportSales_Categorys_byTime_DESC(starttime: any, endtime: any): Promise<any>;
|
|
5099
|
+
/**
|
|
5100
|
+
* lấy về danh sách sản phẩm đã hết hàng
|
|
5101
|
+
* @example:
|
|
5102
|
+
* this.vhQueryCafe.getReportMaterials_byOutOfStock()
|
|
5103
|
+
.then((products)=>{
|
|
5104
|
+
console.log(products);
|
|
5105
|
+
})
|
|
5106
|
+
* @param IDbranch: 'all' or id_branch;
|
|
5107
|
+
*/
|
|
5108
|
+
getReportMaterials_byOutOfStock(IDbranch?: any): Promise<any>;
|
|
5109
|
+
/**
|
|
5110
|
+
* lấy về danh sách sản phẩm sắp hết hàng
|
|
5111
|
+
* @example:
|
|
5112
|
+
* this.vhQueryCafe.getReportMaterials_byLowInStock()
|
|
5113
|
+
.then((products)=>{
|
|
5114
|
+
console.log(products);
|
|
5115
|
+
})
|
|
5116
|
+
* @param IDbranch: 'all' or id_branch;
|
|
5117
|
+
*/
|
|
5118
|
+
getReportMaterials_byLowInStock(IDbranch?: any): Promise<any>;
|
|
5119
|
+
private makeCorrectQuantityMaterials;
|
|
5120
|
+
/**
|
|
5121
|
+
* lấy về 1 bảng báo cáo (report) theo cấu trúc json ở dưới
|
|
5122
|
+
* @example:
|
|
5123
|
+
* this.vhQueryCafe.getReportInventoryTime_byTimes('hNCda0obCvrX6qC3PZ0N')
|
|
5124
|
+
.then((reports)=>{
|
|
5125
|
+
console.log('reports',reports);
|
|
5126
|
+
})
|
|
5127
|
+
* @param id_inventorytime
|
|
5128
|
+
* @return Promise json = {docs(array), empty(boolean), size(number), total_stock(number), total_inventorynotes(array)}
|
|
5129
|
+
* docs(array) --> {id(string), data()(object), stock(number), inventorynotes(array)}
|
|
5130
|
+
* inventorynotes(array) --> [{bill_code(string), quantity(number)},{},...]
|
|
5131
|
+
*/
|
|
5132
|
+
getReportInventoryTime_byTimes(id_inventorytime: any): Promise<any>;
|
|
5133
|
+
/*****************************************************************************************************
|
|
5134
|
+
******************************* CHƯƠNG TRÌNH BÁN HÀNG ***********************************************
|
|
5135
|
+
*****************************************************************************************************/
|
|
5136
|
+
/******************************************TÍCH ĐIỂM THEO HÓA ĐƠN*************************************/
|
|
5137
|
+
/**
|
|
5138
|
+
* @example:
|
|
5139
|
+
* let data ={
|
|
5140
|
+
name : 'chương trình tích điểm hóa đơn',
|
|
5141
|
+
exchange :{
|
|
5142
|
+
money : 100000,
|
|
5143
|
+
points : 1
|
|
5144
|
+
},
|
|
5145
|
+
bill_total_minimum :0,
|
|
5146
|
+
payment :{
|
|
5147
|
+
enable : true,
|
|
5148
|
+
money : 100000,
|
|
5149
|
+
points : 1
|
|
5150
|
+
},
|
|
5151
|
+
include_discount: false,
|
|
5152
|
+
include_promotion_product : false,
|
|
5153
|
+
include_paid_points : false,
|
|
5154
|
+
include_tax : false,
|
|
5155
|
+
include_fee : false,
|
|
5156
|
+
//id_branch : '5fb6780ca2148e09806c5b01', //trong hàm đã thêm vào
|
|
5157
|
+
earned_points_clear_auto:{
|
|
5158
|
+
enable,
|
|
5159
|
+
months_of_year: 1
|
|
5160
|
+
}
|
|
5161
|
+
}
|
|
5162
|
+
this.vhQueryCafe.addEarningPointsBill(data)
|
|
5163
|
+
.then((earningpoint)=>{
|
|
5164
|
+
console.log('addEarningPointsBill', earningpoint);
|
|
5165
|
+
},error=>{
|
|
5166
|
+
console.log('error', error);
|
|
5167
|
+
})
|
|
5168
|
+
* @param data
|
|
5169
|
+
* @return Promise => obj = {}
|
|
5170
|
+
*/
|
|
5171
|
+
addEarningPointsBill(data: any): Promise<unknown>;
|
|
5172
|
+
/**
|
|
5173
|
+
* @example:
|
|
5174
|
+
let data ={
|
|
5175
|
+
name : 'chương trình tích điểm hóa đơn',
|
|
5176
|
+
exchange :{
|
|
5177
|
+
money : 100000,
|
|
5178
|
+
points : 1
|
|
5179
|
+
},
|
|
5180
|
+
bill_total_minimum :0,
|
|
5181
|
+
payment :{
|
|
5182
|
+
enable : true,
|
|
5183
|
+
money : 100000,
|
|
5184
|
+
points : 1
|
|
5185
|
+
},
|
|
5186
|
+
include_discount: false,
|
|
5187
|
+
include_promotion_product : false,
|
|
5188
|
+
include_paid_points : false,
|
|
5189
|
+
include_tax : false,
|
|
5190
|
+
include_fee : false,
|
|
5191
|
+
id_branch : '5fb6780ca2148e09806c5b01'
|
|
5192
|
+
}
|
|
5193
|
+
* @param id_earning_points_bill
|
|
5194
|
+
* @param data
|
|
5195
|
+
* @return Promise => bool = true or false
|
|
5196
|
+
*/
|
|
5197
|
+
updateEarningPointsBill(id_earning_points_bill: string, data: object): Promise<unknown>;
|
|
5198
|
+
/**
|
|
5199
|
+
* @example:
|
|
5200
|
+
* this.vhQueryCafe.deleteEarningPointsBill('5fb67fda87c0f21d484cbdf3')
|
|
5201
|
+
.then((bool)=>{
|
|
5202
|
+
console.log('deleteEarningPointsBill', bool);
|
|
5203
|
+
})
|
|
5204
|
+
* @param id_earning_points_bill
|
|
5205
|
+
* @return Promise => bool = true or false
|
|
5206
|
+
*/
|
|
5207
|
+
deleteEarningPointsBill(id_earning_points_bill: string): Promise<unknown>;
|
|
5208
|
+
/**
|
|
5209
|
+
* @example
|
|
5210
|
+
* this.vhQueryCafe.getEarningPointsBill('5fb67fda87c0f21d484cbdf3')
|
|
5211
|
+
.then((earning_points_bill)=>{
|
|
5212
|
+
console.log('getEarningPointsBill', earning_points_bills);
|
|
5213
|
+
},error=>{
|
|
5214
|
+
reject(error);
|
|
5215
|
+
})
|
|
5216
|
+
* @param id_earning_points_bill
|
|
5217
|
+
* @return Promise => obj ={} or null
|
|
5218
|
+
*/
|
|
5219
|
+
getEarningPointsBill(id_earning_points_bill: string): Promise<unknown>;
|
|
5220
|
+
/**
|
|
5221
|
+
* @example
|
|
5222
|
+
* this.vhQueryCafe.getEarningPointsBills()
|
|
5223
|
+
.then((earning_points_bills)=>{
|
|
5224
|
+
console.log('getEarningPointsBills', earning_points_bills);
|
|
5225
|
+
})
|
|
5226
|
+
* @return Promise => array(object) = [{},{},..]
|
|
5227
|
+
*/
|
|
5228
|
+
getEarningPointsBills(): Promise<unknown>;
|
|
5229
|
+
/**
|
|
5230
|
+
* @example:
|
|
5231
|
+
* let data ={
|
|
5232
|
+
name : 'chương trình tích điểm sản phẩm',
|
|
5233
|
+
exchange :{
|
|
5234
|
+
money : 100000,
|
|
5235
|
+
points : 1
|
|
5236
|
+
},
|
|
5237
|
+
payment :{
|
|
5238
|
+
enable : true,
|
|
5239
|
+
money : 100000,
|
|
5240
|
+
points : 1
|
|
5241
|
+
},
|
|
5242
|
+
products:['05ztAR5h3UslYo70Amut','0S8NOcG8wEUYWVo1weHV','0tmbM5SyGe5O1mvuh61l',...],
|
|
5243
|
+
include_promotion_product : false,
|
|
5244
|
+
include_paid_points : false,
|
|
5245
|
+
//id_branch : '5fb6780ca2148e09806c5b01' //trong hàm đã thêm vào
|
|
5246
|
+
}
|
|
5247
|
+
this.vhQueryCafe.addEarningPointsProduct(data)
|
|
5248
|
+
.then((res)=>{
|
|
5249
|
+
console.log('addEarningPointsProduct', res);
|
|
5250
|
+
}, error=>{
|
|
5251
|
+
console.log('error', error);
|
|
5252
|
+
})
|
|
5253
|
+
* @param data
|
|
5254
|
+
* @return Promise => object or error
|
|
5255
|
+
*/
|
|
5256
|
+
addEarningPointsProduct(data: any): Promise<unknown>;
|
|
5257
|
+
/**
|
|
5258
|
+
* @example:
|
|
5259
|
+
let data ={
|
|
5260
|
+
name : 'chương trình tích điểm sản phẩm',
|
|
5261
|
+
exchange :{
|
|
5262
|
+
money : 100000,
|
|
5263
|
+
points : 1
|
|
5264
|
+
},
|
|
5265
|
+
payment :{
|
|
5266
|
+
enable : true,
|
|
5267
|
+
money : 100000,
|
|
5268
|
+
points : 1
|
|
5269
|
+
},
|
|
5270
|
+
include_promotion_product : false,
|
|
5271
|
+
include_paid_points : false,
|
|
5272
|
+
id_branch : '5fb6780ca2148e09806c5b01'
|
|
5273
|
+
}
|
|
5274
|
+
* this.vhQueryCafe.updateEarningPointsProduct(id_earning_points_product,data)
|
|
5275
|
+
.then((bool)=>{
|
|
5276
|
+
console.log('updateEarningPointsProduct', bool);
|
|
5277
|
+
}, error=>{
|
|
5278
|
+
console.log('error', error);
|
|
5279
|
+
})
|
|
5280
|
+
* @param id_earning_points_product
|
|
5281
|
+
* @param data
|
|
5282
|
+
* @return Promise => bool = true or false
|
|
5283
|
+
*/
|
|
5284
|
+
updateEarningPointsProduct(id_earning_points_product: any, data: any): Promise<unknown>;
|
|
5285
|
+
/**
|
|
5286
|
+
* @example:
|
|
5287
|
+
* this.vhQueryCafe.deleteEarningPointsProduct('654QFNMOIYUENC321')
|
|
5288
|
+
.then((bool)=>{
|
|
5289
|
+
console.log('deleteEarningPointsProduct', bool);
|
|
5290
|
+
}, error=>{
|
|
5291
|
+
console.log('error', error);
|
|
5292
|
+
})
|
|
5293
|
+
* @param id_earning_points_product
|
|
5294
|
+
* @return Promise => bool = true or false
|
|
5295
|
+
*/
|
|
5296
|
+
deleteEarningPointsProduct(id_earning_points_product: any): Promise<unknown>;
|
|
5297
|
+
/**
|
|
5298
|
+
* @example:
|
|
5299
|
+
* this.vhQueryCafe.getEarningPointsProduct('654QFNMOIYUENC321')
|
|
5300
|
+
.then((res)=>{
|
|
5301
|
+
console.log('getEarningPointsProduct', res);
|
|
5302
|
+
}, error=>{
|
|
5303
|
+
console.log('error', error);
|
|
5304
|
+
})
|
|
5305
|
+
* @param id_earning_points_product
|
|
5306
|
+
* @return Promise => object or null
|
|
5307
|
+
*/
|
|
5308
|
+
getEarningPointsProduct(id_earning_points_product: any): Promise<unknown>;
|
|
5309
|
+
/**
|
|
5310
|
+
* @example:
|
|
5311
|
+
* this.vhQueryCafe.getEarningPointsProducts()
|
|
5312
|
+
.then((arr)=>{
|
|
5313
|
+
console.log('getEarningPointsProducts', arr);
|
|
5314
|
+
}, error=>{
|
|
5315
|
+
console.log('error', error);
|
|
5316
|
+
})
|
|
5317
|
+
* @return Promise => Array<object>
|
|
5318
|
+
*/
|
|
5319
|
+
getEarningPointsProducts(): Promise<unknown>;
|
|
5320
|
+
/**
|
|
5321
|
+
* @example:
|
|
5322
|
+
* this.vhQueryCafe.addEmployeeClass({name : "Gold"})
|
|
5323
|
+
.then((res)=>{
|
|
5324
|
+
console.log('addEmployeeClass', res);
|
|
5325
|
+
}, error=>{
|
|
5326
|
+
console.log('error', error);
|
|
5327
|
+
})
|
|
5328
|
+
* @param data
|
|
5329
|
+
* @return Promise => object or error
|
|
5330
|
+
*/
|
|
5331
|
+
addEmployeeClass(data: any): Promise<unknown>;
|
|
5332
|
+
/**
|
|
5333
|
+
* @example:
|
|
5334
|
+
* this.vhQueryCafe.updateEmployeeClass('KNOVIYWKN135468',{id_commission : "321SDWC65DWSVDFS"})
|
|
5335
|
+
.then((bool)=>{
|
|
5336
|
+
console.log('updateEmployeeClass', bool);
|
|
5337
|
+
}, error=>{
|
|
5338
|
+
console.log('error', error);
|
|
5339
|
+
})
|
|
5340
|
+
* @param id_employee_class
|
|
5341
|
+
* @param data
|
|
5342
|
+
* @return Promise => bool = true or false
|
|
5343
|
+
*/
|
|
5344
|
+
updateEmployeeClass(id_employee_class: any, data: any): Promise<unknown>;
|
|
5345
|
+
/**
|
|
5346
|
+
* @example:
|
|
5347
|
+
* this.vhQueryCafe.deleteEmployeeClass('KNOVIYWKN135468')
|
|
5348
|
+
.then((bool)=>{
|
|
5349
|
+
console.log('deleteEmployeeClass', bool);
|
|
5350
|
+
}, error=>{
|
|
5351
|
+
console.log('error', error);
|
|
5352
|
+
})
|
|
5353
|
+
* @param id_employee_class
|
|
5354
|
+
* @return Promise => bool = true or false
|
|
5355
|
+
*/
|
|
5356
|
+
deleteEmployeeClass(id_employee_class: any): Promise<unknown>;
|
|
5357
|
+
/**
|
|
5358
|
+
* @example:
|
|
5359
|
+
* this.vhQueryCafe.getEmployeeClass('KNOVIYWKN135468')
|
|
5360
|
+
.then((res)=>{
|
|
5361
|
+
console.log('getEmployeeClass', res);
|
|
5362
|
+
}, error=>{
|
|
5363
|
+
console.log('error', error);
|
|
5364
|
+
})
|
|
5365
|
+
* @param id_employee_class
|
|
5366
|
+
* @return Promise => object or null
|
|
5367
|
+
*/
|
|
5368
|
+
getEmployeeClass(id_employee_class: any): Promise<unknown>;
|
|
5369
|
+
/**
|
|
5370
|
+
* @example:
|
|
5371
|
+
* this.vhQueryCafe.getEmployeeClasss()
|
|
5372
|
+
.then((array)=>{
|
|
5373
|
+
console.log('getEmployeeClasss', array);
|
|
5374
|
+
}, error=>{
|
|
5375
|
+
console.log('error', error);
|
|
5376
|
+
})
|
|
5377
|
+
* @param id_employee_class
|
|
5378
|
+
* @return Promise => Array<object>
|
|
5379
|
+
*/
|
|
5380
|
+
getEmployeeClasss(): Promise<unknown>;
|
|
5381
|
+
/**
|
|
5382
|
+
* trong local chưa có
|
|
5383
|
+
* @example:
|
|
5384
|
+
* let employee_classs = this.vhQueryCafe.getlocalEmployeeClasss()
|
|
5385
|
+
* @param data
|
|
5386
|
+
* @return Array<object>
|
|
5387
|
+
*/
|
|
5388
|
+
getlocalEmployeeClasss(): void;
|
|
5389
|
+
/**
|
|
5390
|
+
* trong local chưa có
|
|
5391
|
+
* @example:
|
|
5392
|
+
* let employee_class = this.vhQueryCafe.getlocalEmployeeClass('321987965DOIUEHN')
|
|
5393
|
+
* @param id_employee_class
|
|
5394
|
+
* @return object or null
|
|
5395
|
+
*/
|
|
5396
|
+
getlocalEmployeeClass(id_customer_class: any): void;
|
|
5397
|
+
/**
|
|
5398
|
+
* @example:
|
|
5399
|
+
* let data = {
|
|
5400
|
+
* name:"Phiếu thanh toán 100k",
|
|
5401
|
+
* value : 100000,
|
|
5402
|
+
* point : 1000,
|
|
5403
|
+
* id_design_barcode : "",
|
|
5404
|
+
* //id_branch :" 316OIUHLKMLSDYW235" //trong hàm đã có thêm vào
|
|
5405
|
+
* }
|
|
5406
|
+
* this.vhQueryCafe.addCoupon(data)
|
|
5407
|
+
.then((res)=>{
|
|
5408
|
+
console.log('addCoupon', res);
|
|
5409
|
+
}, error=>{
|
|
5410
|
+
console.log('error', error);
|
|
5411
|
+
})
|
|
5412
|
+
* @param data
|
|
5413
|
+
* @return Promise => object or error
|
|
5414
|
+
*/
|
|
5415
|
+
addCoupon(data: any): Promise<unknown>;
|
|
5416
|
+
/**
|
|
5417
|
+
* @example:
|
|
5418
|
+
* let data = {
|
|
5419
|
+
* name:"Phiếu thanh toán 100k",
|
|
5420
|
+
* value : 100000,
|
|
5421
|
+
* point : 1000,
|
|
5422
|
+
* id_design_barcode : "",
|
|
5423
|
+
* }
|
|
5424
|
+
* this.vhQueryCafe.updateCoupon('FBHYWIBDNIUH1321687',data)
|
|
5425
|
+
.then((bool)=>{
|
|
5426
|
+
console.log('updateCoupon', bool);
|
|
5427
|
+
}, error=>{
|
|
5428
|
+
console.log('error', error);
|
|
5429
|
+
})
|
|
5430
|
+
* @param data
|
|
5431
|
+
* @param id_coupon
|
|
5432
|
+
* @return Promise => bool = true or false
|
|
5433
|
+
*/
|
|
5434
|
+
updateCoupon(id_coupon: any, data: any): Promise<unknown>;
|
|
5435
|
+
/**
|
|
5436
|
+
* @example:
|
|
5437
|
+
* this.vhQueryCafe.deleteCoupon("9841654DOIWSDYW235")
|
|
5438
|
+
.then((rsp)=>{
|
|
5439
|
+
console.log('deleteCoupon', rsp);
|
|
5440
|
+
if(rsp.vcode == 0){
|
|
5441
|
+
//phát thông báo xóa thành công
|
|
5442
|
+
}else if(rsp.vcode == 1){
|
|
5443
|
+
//phát thông báo lý do xóa ko thành công (dùng câu từ dễ hiểu với khách hàng)
|
|
5444
|
+
}
|
|
5445
|
+
}, error=>{
|
|
5446
|
+
console.log('error', error);
|
|
5447
|
+
})
|
|
5448
|
+
* @param id_coupon
|
|
5449
|
+
* @return Promise => rsp = {vcode, message} / error
|
|
5450
|
+
* vcode == 0 : xóa thành công
|
|
5451
|
+
* vcode == 1 : xóa không thành công, do coupon đã được phát hành, vui lòng xóa đợt phát hành liên quan
|
|
5452
|
+
*/
|
|
5453
|
+
deleteCoupon(id_coupon: any): Promise<unknown>;
|
|
5454
|
+
/**
|
|
5455
|
+
* @example:
|
|
5456
|
+
*
|
|
5457
|
+
* this.vhQueryCafe.getCoupon('FBHYWIBDNIUH1321687')
|
|
5458
|
+
.then((res)=>{
|
|
5459
|
+
console.log('getCoupon', res);
|
|
5460
|
+
}, error=>{
|
|
5461
|
+
console.log('error', error);
|
|
5462
|
+
})
|
|
5463
|
+
* @param id_coupon
|
|
5464
|
+
* @return Promise => object or null
|
|
5465
|
+
*/
|
|
5466
|
+
getCoupon(id_coupon: any): Promise<unknown>;
|
|
5467
|
+
/**
|
|
5468
|
+
* @example:
|
|
5469
|
+
* this.vhQueryCafe.getCoupons()
|
|
5470
|
+
.then((res)=>{
|
|
5471
|
+
console.log('getCoupons', res);
|
|
5472
|
+
}, error=>{
|
|
5473
|
+
console.log('error', error);
|
|
5474
|
+
})
|
|
5475
|
+
* @return Promise => Array<object>
|
|
5476
|
+
*/
|
|
5477
|
+
getCoupons(): Promise<unknown>;
|
|
5478
|
+
/**
|
|
5479
|
+
* @example:
|
|
5480
|
+
* this.vhQueryCafe.addCouponRelease({name : "Đợt phát hành phiếu thanh toán 100k",id_branch :'OHFNEIOUH6549846'})
|
|
5481
|
+
.then((res)=>{
|
|
5482
|
+
console.log('addCouponRelease', res);
|
|
5483
|
+
}, error=>{
|
|
5484
|
+
console.log('error', error);
|
|
5485
|
+
})
|
|
5486
|
+
* @param data
|
|
5487
|
+
* @return Promise => object or error
|
|
5488
|
+
*/
|
|
5489
|
+
addCouponRelease(data: any): Promise<unknown>;
|
|
5490
|
+
/**
|
|
5491
|
+
* @example:
|
|
5492
|
+
* this.vhQueryCafe.updateCouponRelease('ANOFIEUPOIUJ49861',{name : "Đợt phát hành phiếu thanh toán 100k"})
|
|
5493
|
+
.then((bool)=>{
|
|
5494
|
+
console.log('updateCouponRelease', bool);
|
|
5495
|
+
}, error=>{
|
|
5496
|
+
console.log('error', error);
|
|
5497
|
+
})
|
|
5498
|
+
* @param data
|
|
5499
|
+
* @param id_coupon_release
|
|
5500
|
+
* @return Promise => bool = true or false
|
|
5501
|
+
*/
|
|
5502
|
+
updateCouponRelease(id_coupon_release: any, data: any): Promise<unknown>;
|
|
5503
|
+
/**
|
|
5504
|
+
* @example:
|
|
5505
|
+
* this.vhQueryCafe.deleteCouponRelease("9841654DOIWSDYW235")
|
|
5506
|
+
.then((rsp)=>{
|
|
5507
|
+
console.log('deleteCouponRelease', rsp);
|
|
5508
|
+
if(rsp.vcode == 0){
|
|
5509
|
+
//phát thông báo xóa thành công
|
|
5510
|
+
}else if(rsp.vcode == 1){
|
|
5511
|
+
//phát thông báo lý do xóa ko thành công (dùng câu từ dễ hiểu với khách hàng)
|
|
5512
|
+
}
|
|
5513
|
+
}, error=>{
|
|
5514
|
+
console.log('error', error);
|
|
5515
|
+
})
|
|
5516
|
+
* @param id_coupon_release
|
|
5517
|
+
* @return Promise => rsp = {vcode, message} / error
|
|
5518
|
+
* vcode == 0 : xóa thành công
|
|
5519
|
+
* vcode == 1 : xóa không thành công, do trong đợt phát hành đã có coupon cần phát hành, vui lòng xóa coupon khỏi đợt phát hành
|
|
5520
|
+
*/
|
|
5521
|
+
deleteCouponRelease(id_coupon_release: any): Promise<unknown>;
|
|
5522
|
+
/**
|
|
5523
|
+
* @example:
|
|
5524
|
+
*
|
|
5525
|
+
* this.vhQueryCafe.getCouponRelease('FBHYWIBDNIUH1321687')
|
|
5526
|
+
.then((res)=>{
|
|
5527
|
+
console.log('getCouponRelease', res);
|
|
5528
|
+
}, error=>{
|
|
5529
|
+
console.log('error', error);
|
|
5530
|
+
})
|
|
5531
|
+
* @param id_coupon_release
|
|
5532
|
+
* @return Promise => object or null
|
|
5533
|
+
*/
|
|
5534
|
+
getCouponRelease(id_coupon_release: any): Promise<unknown>;
|
|
5535
|
+
/**
|
|
5536
|
+
* @example:
|
|
5537
|
+
*
|
|
5538
|
+
* this.vhQueryCafe.getCouponReleases()
|
|
5539
|
+
.then((arr)=>{
|
|
5540
|
+
console.log('getCouponReleases', arr);
|
|
5541
|
+
}, error=>{
|
|
5542
|
+
console.log('error', error);
|
|
5543
|
+
})
|
|
5544
|
+
* @return Promise => Array< object >
|
|
5545
|
+
*/
|
|
5546
|
+
getCouponReleases(): Promise<unknown>;
|
|
5547
|
+
/**
|
|
5548
|
+
* @example:
|
|
5549
|
+
let data = {
|
|
5550
|
+
id_coupon : "9841654DOIWSDYW235",
|
|
5551
|
+
id_coupon_release :" 316OIUHLKMLSDYW235"
|
|
5552
|
+
}
|
|
5553
|
+
this.vhQueryCafe.addCouponReleaseDetail(data)
|
|
5554
|
+
.then((res)=>{
|
|
5555
|
+
console.log('addCouponReleaseDetail', res);
|
|
5556
|
+
}, error=>{
|
|
5557
|
+
console.log('error', error);
|
|
5558
|
+
})
|
|
5559
|
+
* @param data
|
|
5560
|
+
* @param id_coupon
|
|
5561
|
+
* @return Promise => bool = true or false
|
|
5562
|
+
*/
|
|
5563
|
+
addCouponReleaseDetail(data: any): Promise<unknown>;
|
|
5564
|
+
/**
|
|
5565
|
+
* @example:
|
|
5566
|
+
* this.vhQueryCafe.deleteCouponReleaseDetail("9841654DOIWSDYW235")
|
|
5567
|
+
.then((rsp)=>{
|
|
5568
|
+
console.log('deleteCouponReleaseDetail', rsp);
|
|
5569
|
+
if(rsp.vcode == 0){
|
|
5570
|
+
//phát thông báo xóa thành công
|
|
5571
|
+
}else if(rsp.vcode == 1){
|
|
5572
|
+
//phát thông báo lý do xóa ko thành công (dùng câu từ dễ hiểu với khách hàng)
|
|
5573
|
+
}
|
|
5574
|
+
}, error=>{
|
|
5575
|
+
console.log('error', error);
|
|
5576
|
+
})
|
|
5577
|
+
* @param id_coupon_release_detail
|
|
5578
|
+
* @return Promise => rsp = {vcode, message} / error
|
|
5579
|
+
* vcode == 0 : xóa thành công
|
|
5580
|
+
* vcode == 1 : xóa không thành công, do coupon_code của đợt phát hành chi tiết này có status !=1 (đã được đổi điểm, hoặc đã sử dụng)
|
|
5581
|
+
*/
|
|
5582
|
+
deleteCouponReleaseDetail(id_coupon_release_detail: any): Promise<unknown>;
|
|
5583
|
+
/**
|
|
5584
|
+
* @example:
|
|
5585
|
+
*
|
|
5586
|
+
* this.vhQueryCafe.getCouponReleaseDetail('FBHYWIBDNIUH1321687')
|
|
5587
|
+
.then((res)=>{
|
|
5588
|
+
console.log('getCouponReleaseDetail', res);
|
|
5589
|
+
}, error=>{
|
|
5590
|
+
console.log('error', error);
|
|
5591
|
+
})
|
|
5592
|
+
* @param id_coupon_release_detail
|
|
5593
|
+
* @return Promise => object or null
|
|
5594
|
+
*/
|
|
5595
|
+
getCouponReleaseDetail(id_coupon_release_detail: any): Promise<unknown>;
|
|
5596
|
+
/**
|
|
5597
|
+
* hàm này trả về những Coupon Release Detail của đợt coupon đó
|
|
5598
|
+
* @example:
|
|
5599
|
+
* this.vhQueryCafe.getCouponRelaseDetail_byIdCouponRelease("9841654DOIWSDYW235")
|
|
5600
|
+
.then((array)=>{
|
|
5601
|
+
console.log('getCouponRelaseDetail_byIdCouponRelease', array);
|
|
5602
|
+
}, error=>{
|
|
5603
|
+
console.log('error', error);
|
|
5604
|
+
})
|
|
5605
|
+
* @param id_coupon_release
|
|
5606
|
+
* @return Promise => Array<any> = [{id_coupon_relase, id_coupon, coupon_name, coupon_value, coupon_code_numbers}]
|
|
5607
|
+
*/
|
|
5608
|
+
getCouponRelaseDetail_byIdCouponRelease(id_coupon_release: any): Promise<unknown>;
|
|
5609
|
+
/**
|
|
5610
|
+
* hàm này để phát hành 1 coupon_code
|
|
5611
|
+
* @example:
|
|
5612
|
+
//truyền vào
|
|
5613
|
+
let data = {
|
|
5614
|
+
date_validity: new Date(),
|
|
5615
|
+
date_expire : new Date(),
|
|
5616
|
+
id_coupon_release_detail :"315KHIUHWNIUHCIYUW3187",
|
|
5617
|
+
id_coupon: '9841654DOIWSDYW235'
|
|
5618
|
+
}
|
|
5619
|
+
* this.vhQueryCafe.createCouponCode(data)
|
|
5620
|
+
.then((coupon_code)=>{
|
|
5621
|
+
console.log('createCouponCode', coupon_code);
|
|
5622
|
+
}, error=>{
|
|
5623
|
+
console.log('error', error);
|
|
5624
|
+
})
|
|
5625
|
+
//trả về
|
|
5626
|
+
let data = {
|
|
5627
|
+
_id:'9841654DOIWSDYW235'
|
|
5628
|
+
status: 1,
|
|
5629
|
+
id_branch,
|
|
5630
|
+
|
|
5631
|
+
date_validity: new Date(),
|
|
5632
|
+
date_expire : new Date(),
|
|
5633
|
+
id_coupon_release_detail :"315KHIUHWNIUHCIYUW3187",
|
|
5634
|
+
id_coupon: '9841654DOIWSDYW235'
|
|
5635
|
+
}
|
|
5636
|
+
* @param data
|
|
5637
|
+
* @return Promise => Object
|
|
5638
|
+
*/
|
|
5639
|
+
private createCouponCode;
|
|
5640
|
+
/**
|
|
5641
|
+
* hàm này để phát hành nhiều coupon_code theo số lượng truyền vào, và tự động cập nhật trường số lượng đã phát hành (quantity_released) tăng lên
|
|
5642
|
+
* trong collection coupon_release_details
|
|
5643
|
+
* @example:
|
|
5644
|
+
//truyền vào
|
|
5645
|
+
let data = {
|
|
5646
|
+
date_validity: new Date(),
|
|
5647
|
+
date_expire : new Date(),
|
|
5648
|
+
id_coupon_release_detail :"315KHIUHWNIUHCIYUW3187",
|
|
5649
|
+
id_coupon: '9841654DOIWSDYW235'
|
|
5650
|
+
}
|
|
5651
|
+
* this.vhQueryCafe.createCouponCodes(data, 10)
|
|
5652
|
+
.then((coupon_codes)=>{
|
|
5653
|
+
console.log('createCouponCodes', coupon_codes);
|
|
5654
|
+
}, error=>{
|
|
5655
|
+
console.log('error', error);
|
|
5656
|
+
})
|
|
5657
|
+
//trả về
|
|
5658
|
+
let data = {
|
|
5659
|
+
_id:'9841654DOIWSDYW235'
|
|
5660
|
+
status: 1,
|
|
5661
|
+
id_branch,
|
|
5662
|
+
|
|
5663
|
+
date_validity: new Date(),
|
|
5664
|
+
date_expire : new Date(),
|
|
5665
|
+
id_coupon_release_detail :"315KHIUHWNIUHCIYUW3187",
|
|
5666
|
+
id_coupon: '9841654DOIWSDYW235'
|
|
5667
|
+
}
|
|
5668
|
+
* @param data
|
|
5669
|
+
* @param quantity <=20 : Dev kiểm tra trường quantity nhập vào không được lớn hơn 20
|
|
5670
|
+
* @return Promise => Array(object)
|
|
5671
|
+
*/
|
|
5672
|
+
createCouponCodes(data: any, quantity: number): Promise<unknown>;
|
|
5673
|
+
/**
|
|
5674
|
+
* @example:
|
|
5675
|
+
*
|
|
5676
|
+
* this.vhQueryCafe.updateCouponCode('OUHEOIWUYGHIQNIDOUW1359478',{date_expire : new Date()})
|
|
5677
|
+
.then((bool)=>{
|
|
5678
|
+
console.log('updateCouponCode', bool);
|
|
5679
|
+
}, error=>{
|
|
5680
|
+
console.log('error', error);
|
|
5681
|
+
})
|
|
5682
|
+
* @param id_coupon_code
|
|
5683
|
+
* @param data
|
|
5684
|
+
* @return Promise => boolean = true or false
|
|
5685
|
+
*/
|
|
5686
|
+
updateCouponCode(id_coupon_code: any, data: any): Promise<unknown>;
|
|
5687
|
+
/**
|
|
5688
|
+
* Hàm này chỉ cho phép xóa coupon_code đang ở trạng thái đã phát hành (status ==1),
|
|
5689
|
+
* và cập nhật giảm trường số lượng quantity_released bớt 1 trong collection coupon_release_details
|
|
5690
|
+
* @example:
|
|
5691
|
+
* this.vhQueryCafe.deleteCouponCode('OUHEOIWUYGHIQNIDOUW1359478'})
|
|
5692
|
+
.then((bool)=>{
|
|
5693
|
+
console.log('deleteCouponCode', bool);
|
|
5694
|
+
}, error=>{
|
|
5695
|
+
console.log('error', error);
|
|
5696
|
+
})
|
|
5697
|
+
* @param id_coupon_code
|
|
5698
|
+
* @param id_coupon_release_detail
|
|
5699
|
+
* @return Promise => boolean = true or false
|
|
5700
|
+
*/
|
|
5701
|
+
deleteCouponCode(id_coupon_code: string, id_coupon_release_detail: string): Promise<unknown>;
|
|
5702
|
+
/**
|
|
5703
|
+
* hàm này trả về danh sách coupon code đã phát hành theo mỗi đợt
|
|
5704
|
+
* @example:
|
|
5705
|
+
*
|
|
5706
|
+
* this.vhQueryCafe.getCouponCodes_byIdCouponReleaseDetail('OUHEOIWUYGHIQNIDOUW1359478'})
|
|
5707
|
+
.then((array)=>{
|
|
5708
|
+
console.log('getCouponCodes_byIdCouponReleaseDetail', array);
|
|
5709
|
+
}, error=>{
|
|
5710
|
+
console.log('error', error);
|
|
5711
|
+
})
|
|
5712
|
+
* @param id_coupon_release_detail
|
|
5713
|
+
* @return Promise => Array<any>
|
|
5714
|
+
*/
|
|
5715
|
+
getCouponCodes_byIdCouponReleaseDetail(id_coupon_release_detail: any): Promise<unknown>;
|
|
5716
|
+
/**
|
|
5717
|
+
* hàm này trả về danh sách coupon code đã phát hành theo điều kiện query
|
|
5718
|
+
* @example:
|
|
5719
|
+
* this.vhQueryCafe.getCouponCodes_byFields({status:{$eq: 1}}, {}, {}, 0)
|
|
5720
|
+
.then((res)=>{
|
|
5721
|
+
console.log('getCouponCodes_byFields', res);
|
|
5722
|
+
}, error=>{
|
|
5723
|
+
console.log('error', error);
|
|
5724
|
+
})
|
|
5725
|
+
* @param query
|
|
5726
|
+
* @param projection
|
|
5727
|
+
* @param sort
|
|
5728
|
+
* @param limit
|
|
5729
|
+
* @return Promise => array(object) = [{},{},..]
|
|
5730
|
+
*/
|
|
5731
|
+
getCouponCodes_byFields(query: object, projection: object, sort: object, limit: number): Promise<unknown>;
|
|
5732
|
+
/**
|
|
5733
|
+
* hàm này trả về coupon_code đã phát hành theo trường _id của Coupon_code
|
|
5734
|
+
* @example:
|
|
5735
|
+
*
|
|
5736
|
+
* this.vhQueryCafe.getCouponCode('OUHEDW0512'})
|
|
5737
|
+
.then((res)=>{
|
|
5738
|
+
console.log('getCouponCode', res);
|
|
5739
|
+
}, error=>{
|
|
5740
|
+
console.log('error', error);
|
|
5741
|
+
})
|
|
5742
|
+
* @param id_coupon_code: cũng chính là code
|
|
5743
|
+
* @return Promise => obj ={} or null
|
|
5744
|
+
*/
|
|
5745
|
+
getCouponCode(id_coupon_code: any): Promise<unknown>;
|
|
5746
|
+
/**
|
|
5747
|
+
* hàm này trả về coupon_code đã phát hành theo trường code của Coupon_code.
|
|
5748
|
+
* @example:
|
|
5749
|
+
*
|
|
5750
|
+
* this.vhQueryCafe.getCouponCode('OUHEDW0512'})
|
|
5751
|
+
.then((res)=>{
|
|
5752
|
+
console.log('getCouponCode', res);
|
|
5753
|
+
}, error=>{
|
|
5754
|
+
console.log('error', error);
|
|
5755
|
+
})
|
|
5756
|
+
* @param id_coupon_code: cũng chính là code
|
|
5757
|
+
* @return Promise => obj ={} or null
|
|
5758
|
+
*/
|
|
5759
|
+
getCouponCode_byCode(code: any): Promise<unknown>;
|
|
5760
|
+
/**
|
|
5761
|
+
* hàm này trả về coupon_code đã phát hành theo trường _id của voucher_code.
|
|
5762
|
+
* @example:
|
|
5763
|
+
*
|
|
5764
|
+
* this.vhQueryCafe.getCoupon_Code_Name_Release('OUHEDW0512'})
|
|
5765
|
+
.then((res)=>{
|
|
5766
|
+
console.log('getCoupon_Code_Name_Release', res);
|
|
5767
|
+
}, error=>{
|
|
5768
|
+
console.log('error', error);
|
|
5769
|
+
})
|
|
5770
|
+
* @param id_coupon_code: cũng chính là code
|
|
5771
|
+
* @return Promise => obj ={} or null
|
|
5772
|
+
*/
|
|
5773
|
+
getCoupon_Code_Name_Release(id_coupon_code: any): Promise<unknown>;
|
|
5774
|
+
/**
|
|
5775
|
+
* hàm này trả về coupon_code đã phát hành theo trường code của voucher_code. dùng trong thanh toán bằng phiếu,
|
|
5776
|
+
* trả về có cả code, name_coupon, name_coupon_release
|
|
5777
|
+
* @example:
|
|
5778
|
+
*
|
|
5779
|
+
* this.vhQueryCafe.getCoupon_Code_Name_Release_byCode('OUHEDW0512'})
|
|
5780
|
+
.then((res)=>{
|
|
5781
|
+
console.log('getCoupon_Code_Name_Release_byCode', res);
|
|
5782
|
+
}, error=>{
|
|
5783
|
+
console.log('error', error);
|
|
5784
|
+
})
|
|
5785
|
+
* @param id_coupon_code: cũng chính là code
|
|
5786
|
+
* @return Promise => obj ={} or null
|
|
5787
|
+
*/
|
|
5788
|
+
getCoupon_Code_Name_Release_byCode(code: any): Promise<unknown>;
|
|
5789
|
+
/**
|
|
5790
|
+
* hàm này để đổi phiếu từ điểm của khách hàng. Đổi thành công tự động tạo lịch sử đổi điểm của khách hàng
|
|
5791
|
+
* hàm này đã cập nhật lại trường status, id_customer, date_points_exchanged cho coupon_codes
|
|
5792
|
+
* hàm này đã cập nhật lại trường earned_points, id_customer, branch_earned_points cho customers
|
|
5793
|
+
* @example:
|
|
5794
|
+
* let array = [{id_coupon_code, points, value},{}...]
|
|
5795
|
+
* this.vhQueryCafe.exchangeCouponCode_byEarningPoints([array,'1984QIHBSYGWDIOUHIQFE'], 'INBIFDYWUGUHNI65498', 1000})
|
|
5796
|
+
.then((bool)=>{
|
|
5797
|
+
console.log('exchangeCouponCode_byEarningPoints', bool);
|
|
5798
|
+
}, error=>{
|
|
5799
|
+
console.log('error', error);
|
|
5800
|
+
})
|
|
5801
|
+
* @param array_id_coupon_code_and_points_and_value : [{id_coupon_code, points, value}]
|
|
5802
|
+
* @param id_customer
|
|
5803
|
+
* @param total_points_exchanged: tổng điểm của các phiếu đã quy đổi
|
|
5804
|
+
* @return Promise => boolean = true or false
|
|
5805
|
+
*/
|
|
5806
|
+
exchangeCouponCode_byEarningPoints(array_id_coupon_code_and_points_and_value: any, id_customer: any, total_points_exchanged: any): Promise<unknown>;
|
|
5807
|
+
/**
|
|
5808
|
+
* @example:
|
|
5809
|
+
* let data = {
|
|
5810
|
+
name : "Siêu khuyến mãi",
|
|
5811
|
+
id_design_barcode :"316OIUHLKMLSDYW235",
|
|
5812
|
+
products: [{
|
|
5813
|
+
id_product : "NIDOUHWIOLDNOIU1142748",
|
|
5814
|
+
price : 1000000,
|
|
5815
|
+
quantity: 1,
|
|
5816
|
+
ptype: 1
|
|
5817
|
+
}],
|
|
5818
|
+
point: 10,
|
|
5819
|
+
price_origin: 9300000,
|
|
5820
|
+
price: 9200000,
|
|
5821
|
+
id_branch: 4zFGhVUAZyj5d09r01xZ
|
|
5822
|
+
}
|
|
5823
|
+
* this.vhQueryCafe.addVoucher(data)
|
|
5824
|
+
.then((res)=>{
|
|
5825
|
+
console.log('addVoucher', res);
|
|
5826
|
+
}, error=>{
|
|
5827
|
+
console.log('error', error);
|
|
5828
|
+
})
|
|
5829
|
+
* @param data
|
|
5830
|
+
* @return object or error
|
|
5831
|
+
*/
|
|
5832
|
+
addVoucher(data: any): Promise<unknown>;
|
|
5833
|
+
/**
|
|
5834
|
+
* @example:
|
|
5835
|
+
* let data = {
|
|
5836
|
+
point: 23,
|
|
5837
|
+
price_origin: 9400000,
|
|
5838
|
+
id_branch: 4zFGhVUAZyj5d09r01xZ
|
|
5839
|
+
}
|
|
5840
|
+
* this.vhQueryCafe.updateVoucher("fuMS21I6othUm34385WV", data)
|
|
5841
|
+
.then((bool)=>{
|
|
5842
|
+
console.log('updateVoucher', bool);
|
|
5843
|
+
}, error=>{
|
|
5844
|
+
console.log('error', error);
|
|
5845
|
+
})
|
|
5846
|
+
* @param id_voucher
|
|
5847
|
+
* @param data
|
|
5848
|
+
* @return Promise Boolean => true or false
|
|
5849
|
+
*/
|
|
5850
|
+
updateVoucher(id_voucher: any, data: any): Promise<unknown>;
|
|
5851
|
+
/**
|
|
5852
|
+
* @example:
|
|
5853
|
+
* this.vhQueryCafe.deleteVoucher("9841654DOIWSDYW235")
|
|
5854
|
+
.then((rsp)=>{
|
|
5855
|
+
console.log('deleteVoucher', rsp);
|
|
5856
|
+
if(rsp.vcode == 0){
|
|
5857
|
+
//phát thông báo xóa thành công
|
|
5858
|
+
}else if(rsp.vcode == 1){
|
|
5859
|
+
//phát thông báo lý do xóa ko thành công (dùng câu từ dễ hiểu với khách hàng)
|
|
5860
|
+
}
|
|
5861
|
+
}, error=>{
|
|
5862
|
+
console.log('error', error);
|
|
5863
|
+
})
|
|
5864
|
+
* @param id_voucher
|
|
5865
|
+
* @return Promise => rsp = {vcode, message} / error
|
|
5866
|
+
* vcode == 0 : xóa thành công
|
|
5867
|
+
* vcode == 1 : xóa không thành công, do voucher đã được phát hành, vui lòng xóa đợt phát hành liên quan
|
|
5868
|
+
*/
|
|
5869
|
+
deleteVoucher(id_voucher: any): Promise<unknown>;
|
|
5870
|
+
/**
|
|
5871
|
+
* @example:
|
|
5872
|
+
* this.vhQueryCafe.getVoucher(id_voucher)
|
|
5873
|
+
.then((res)=>{
|
|
5874
|
+
console.log('addVoucher', res);
|
|
5875
|
+
}, error=>{
|
|
5876
|
+
console.log('error', error);
|
|
5877
|
+
})
|
|
5878
|
+
* @param id_voucher
|
|
5879
|
+
* @return Promise => object or null
|
|
5880
|
+
*/
|
|
5881
|
+
getVoucher(id_voucher: any): Promise<unknown>;
|
|
5882
|
+
/**
|
|
5883
|
+
* @example:
|
|
5884
|
+
* this.vhQueryCafe.getVouchers()
|
|
5885
|
+
.then((arr)=>{
|
|
5886
|
+
console.log('getVouchers', arr);
|
|
5887
|
+
}, error=>{
|
|
5888
|
+
console.log('error', error);
|
|
5889
|
+
})
|
|
5890
|
+
* @return Promise => array(object) =[{},{},...]
|
|
5891
|
+
*/
|
|
5892
|
+
getVouchers(): Promise<unknown>;
|
|
5893
|
+
/**
|
|
5894
|
+
* @example:
|
|
5895
|
+
* let data = {
|
|
5896
|
+
name : "Tháng 6 bùng nổ",
|
|
5897
|
+
id_branch: 4zFGhVUAZyj5d09r01xZ
|
|
5898
|
+
}
|
|
5899
|
+
* this.vhQueryCafe.addVoucherRelease(data)
|
|
5900
|
+
.then((res)=>{
|
|
5901
|
+
console.log('addVoucherRelease', res);
|
|
5902
|
+
}, error=>{
|
|
5903
|
+
console.log('error', error);
|
|
5904
|
+
})
|
|
5905
|
+
* @param data
|
|
5906
|
+
* @return object or error
|
|
5907
|
+
*/
|
|
5908
|
+
addVoucherRelease(data: any): Promise<unknown>;
|
|
5909
|
+
/**
|
|
5910
|
+
* @example:
|
|
5911
|
+
* let data = {
|
|
5912
|
+
name : "Tháng 6 bùng nổ"
|
|
5913
|
+
}
|
|
5914
|
+
* this.vhQueryCafe.updateVoucherRelease("fuMS21I6othUm34385WV", data)
|
|
5915
|
+
.then((bool)=>{
|
|
5916
|
+
console.log('updateVoucherRelease', bool);
|
|
5917
|
+
}, error=>{
|
|
5918
|
+
console.log('error', error);
|
|
5919
|
+
})
|
|
5920
|
+
* @param id_voucher_release
|
|
5921
|
+
* @param data
|
|
5922
|
+
* @return Promise Boolean => true or false
|
|
5923
|
+
*/
|
|
5924
|
+
updateVoucherRelease(id_voucher_release: any, data: any): Promise<unknown>;
|
|
5925
|
+
/**
|
|
5926
|
+
* @example:
|
|
5927
|
+
* this.vhQueryCafe.deleteVoucherRelease("9841654DOIWSDYW235")
|
|
5928
|
+
.then((rsp)=>{
|
|
5929
|
+
console.log('deleteVoucherRelease', rsp);
|
|
5930
|
+
if(rsp.vcode == 0){
|
|
5931
|
+
//phát thông báo xóa thành công
|
|
5932
|
+
}else if(rsp.vcode == 1){
|
|
5933
|
+
//phát thông báo lý do xóa ko thành công (dùng câu từ dễ hiểu với khách hàng)
|
|
5934
|
+
}
|
|
5935
|
+
}, error=>{
|
|
5936
|
+
console.log('error', error);
|
|
5937
|
+
})
|
|
5938
|
+
* @param id_voucher_release
|
|
5939
|
+
* @return Promise => rsp = {vcode, message} / error
|
|
5940
|
+
* vcode == 0 : xóa thành công
|
|
5941
|
+
* vcode == 1 : xóa không thành công, do trong đợt phát hành đã có voucher cần phát hành, vui lòng xóa voucher khỏi đợt phát hành
|
|
5942
|
+
*/
|
|
5943
|
+
deleteVoucherRelease(id_voucher_release: any): Promise<unknown>;
|
|
5944
|
+
/**
|
|
5945
|
+
* @example:
|
|
5946
|
+
* this.vhQueryCafe.getVoucherRelease("fuMS21I6othUm34385WV")
|
|
5947
|
+
.then((res)=>{
|
|
5948
|
+
console.log('getVoucherRelease', res);
|
|
5949
|
+
}, error=>{
|
|
5950
|
+
console.log('error', error);
|
|
5951
|
+
})
|
|
5952
|
+
* @param id_voucher_release
|
|
5953
|
+
* @return Promise => object or null
|
|
5954
|
+
*/
|
|
5955
|
+
getVoucherRelease(id_voucher_release: any): Promise<unknown>;
|
|
5956
|
+
/**
|
|
5957
|
+
* @example:
|
|
5958
|
+
* this.vhQueryCafe.getVoucherRelases()
|
|
5959
|
+
.then((res)=>{
|
|
5960
|
+
console.log('getVoucherRelases', res);
|
|
5961
|
+
}, error=>{
|
|
5962
|
+
console.log('error', error);
|
|
5963
|
+
})
|
|
5964
|
+
* @return Promise => array(object) =[{},{},...]
|
|
5965
|
+
*/
|
|
5966
|
+
getVoucherRelases(): Promise<unknown>;
|
|
5967
|
+
/**
|
|
5968
|
+
* @example:
|
|
5969
|
+
* let data = {
|
|
5970
|
+
id_voucher : "fuMS21I6othUm34385WV",
|
|
5971
|
+
id_voucher_release: "4zFGhVUAZyj5d09r01xZ"
|
|
5972
|
+
}
|
|
5973
|
+
* this.vhQueryCafe.addVoucherReleaseDetail(data)
|
|
5974
|
+
.then((res)=>{
|
|
5975
|
+
console.log('addVoucherReleaseDetail', res);
|
|
5976
|
+
}, error=>{
|
|
5977
|
+
console.log('error', error);
|
|
5978
|
+
})
|
|
5979
|
+
* @param data
|
|
5980
|
+
* @return object or error
|
|
5981
|
+
*/
|
|
5982
|
+
addVoucherReleaseDetail(data: any): Promise<unknown>;
|
|
5983
|
+
/**
|
|
5984
|
+
* @example:
|
|
5985
|
+
* this.vhQueryCafe.deleteVoucherReleaseDetail("9841654DOIWSDYW235")
|
|
5986
|
+
.then((rsp)=>{
|
|
5987
|
+
console.log('deleteVoucherReleaseDetail', rsp);
|
|
5988
|
+
if(rsp.vcode == 0){
|
|
5989
|
+
//phát thông báo xóa thành công
|
|
5990
|
+
}else if(rsp.vcode == 1){
|
|
5991
|
+
//phát thông báo lý do xóa ko thành công (dùng câu từ dễ hiểu với khách hàng)
|
|
5992
|
+
}
|
|
5993
|
+
}, error=>{
|
|
5994
|
+
console.log('error', error);
|
|
5995
|
+
})
|
|
5996
|
+
* @param id_voucher_release_detail
|
|
5997
|
+
* @return Promise => rsp = {vcode, message} / error
|
|
5998
|
+
* vcode == 0 : xóa thành công
|
|
5999
|
+
* vcode == 1 : xóa không thành công, do voucher_code của đợt phát hành chi tiết này có status !=1 (đã được đổi điểm, hoặc đã sử dụng)
|
|
6000
|
+
*/
|
|
6001
|
+
deleteVoucherReleaseDetail(id_voucher_release_detail: any): Promise<unknown>;
|
|
6002
|
+
/**
|
|
6003
|
+
* @example:
|
|
6004
|
+
* this.vhQueryCafe.getVoucherReleaseDetail("fuMS21I6othUm34385WV")
|
|
6005
|
+
.then((res)=>{
|
|
6006
|
+
console.log('getVoucherReleaseDetail', res);
|
|
6007
|
+
}, error=>{
|
|
6008
|
+
console.log('error', error);
|
|
6009
|
+
})
|
|
6010
|
+
* @param (id_voucher_release_detail)
|
|
6011
|
+
* @return Promise => object or null
|
|
6012
|
+
*/
|
|
6013
|
+
getVoucherReleaseDetail(id_voucher_release_detail: string): Promise<unknown>;
|
|
6014
|
+
/**
|
|
6015
|
+
* @example:
|
|
6016
|
+
* this.vhQueryCafe.getVoucherRelaseDetail_byFields( {id_voucher:{$eq: "316OIUHLKMLSDYW235"}}, {}, {}, 0)
|
|
6017
|
+
.then((res)=>{
|
|
6018
|
+
console.log('getVoucherRelaseDetail_byFields', res);
|
|
6019
|
+
}, error=>{
|
|
6020
|
+
console.log('error', error);
|
|
6021
|
+
})
|
|
6022
|
+
* @param query
|
|
6023
|
+
* @param projection
|
|
6024
|
+
* @param sort
|
|
6025
|
+
* @param limit
|
|
6026
|
+
* @return Promise => array(object) = [{},{},..]
|
|
6027
|
+
*/
|
|
6028
|
+
getVoucherRelaseDetail_byFields(query: object, projection: object, sort: object, limit: number): Promise<unknown>;
|
|
6029
|
+
/**
|
|
6030
|
+
* hàm này để phát hành 1 voucher_code
|
|
6031
|
+
* @example:
|
|
6032
|
+
let data = {
|
|
6033
|
+
date_validity: new Date(),
|
|
6034
|
+
date_expire: new Date(),
|
|
6035
|
+
id_voucher_release_detail: "fuMS21I6othUm34385WV",
|
|
6036
|
+
id_voucher: '9841654DOIWSDYW235'
|
|
6037
|
+
}
|
|
6038
|
+
* this.vhQueryCafe.createVoucherCode(data)
|
|
6039
|
+
.then((voucher_code)=>{
|
|
6040
|
+
console.log('createVoucherCode', voucher_code);
|
|
6041
|
+
}, error=>{
|
|
6042
|
+
console.log('error', error);
|
|
6043
|
+
})
|
|
6044
|
+
* @param data
|
|
6045
|
+
* @return Promise => Object
|
|
6046
|
+
*/
|
|
6047
|
+
createVoucherCode(data: any): Promise<unknown>;
|
|
6048
|
+
/**
|
|
6049
|
+
* hàm này để phát hành nhiều voucher_code theo số lượng truyền vào, và tự động cập nhật trường số lượng đã phát hành (quantity_released) tăng lên
|
|
6050
|
+
* trong collection voucher_release_details
|
|
6051
|
+
* @example:
|
|
6052
|
+
let data = {
|
|
6053
|
+
date_validity: new Date(),
|
|
6054
|
+
date_expire: new Date(),
|
|
6055
|
+
id_voucher_release_detail: "fuMS21I6othUm34385WV",
|
|
6056
|
+
id_voucher: '9841654DOIWSDYW235'
|
|
6057
|
+
}
|
|
6058
|
+
* this.vhQueryCafe.createVoucherCodes(data, 10)
|
|
6059
|
+
.then((voucher_codes)=>{
|
|
6060
|
+
console.log('createVoucherCodes', voucher_codes);
|
|
6061
|
+
}, error=>{
|
|
6062
|
+
console.log('error', error);
|
|
6063
|
+
})
|
|
6064
|
+
* @param data
|
|
6065
|
+
* @param quantity
|
|
6066
|
+
* @return Promise => Array(object)
|
|
6067
|
+
*/
|
|
6068
|
+
createVoucherCodes(data: any, quantity: number): Promise<unknown>;
|
|
6069
|
+
/**
|
|
6070
|
+
* @example:
|
|
6071
|
+
*
|
|
6072
|
+
* this.vhQueryCafe.updateVoucherCode('OUHEOIWUYGHIQNIDOUW1359478',{date_expire : new Date()})
|
|
6073
|
+
.then((bool)=>{
|
|
6074
|
+
console.log('updateCouponCode', bool);
|
|
6075
|
+
}, error=>{
|
|
6076
|
+
console.log('error', error);
|
|
6077
|
+
})
|
|
6078
|
+
* @param id_voucher_code
|
|
6079
|
+
* @param data
|
|
6080
|
+
* @return Promise => boolean = true or false
|
|
6081
|
+
*/
|
|
6082
|
+
updateVoucherCode(id_voucher_code: any, data: any): Promise<unknown>;
|
|
6083
|
+
/**
|
|
6084
|
+
* Hàm này chỉ cho phép xóa voucher_code đang ở trạng thái đã phát hành (status ==1),
|
|
6085
|
+
* và cập nhật giảm trường số lượng quantity_released bớt một trong collection voucher_release_details
|
|
6086
|
+
* @example:
|
|
6087
|
+
* this.vhQueryCafe.deleteVoucherCode('BjHxEYPWrB0rPwfj2L9R', 'CBrcRQIL11lwcHBljliW'})
|
|
6088
|
+
.then((bool)=>{
|
|
6089
|
+
console.log('deleteVoucherCode', bool);
|
|
6090
|
+
}, error=>{
|
|
6091
|
+
console.log('error', error);
|
|
6092
|
+
})
|
|
6093
|
+
* @param id_voucher_code
|
|
6094
|
+
* @param id_voucher_release_detail
|
|
6095
|
+
* @return Promise => boolean = true or false
|
|
6096
|
+
*/
|
|
6097
|
+
deleteVoucherCode(id_voucher_code: string, id_voucher_release_detail: string): Promise<unknown>;
|
|
6098
|
+
/**
|
|
6099
|
+
* hàm này trả về danh sách voucher_codes đã phát hành theo mỗi đợt
|
|
6100
|
+
* @example:
|
|
6101
|
+
* this.vhQueryCafe.getVoucherCodes_byIdCouponReleaseDetail('OUHEOIWUYGHIQNIDOUW1359478'})
|
|
6102
|
+
.then((array)=>{
|
|
6103
|
+
console.log('getVoucherCodes_byIdCouponReleaseDetail', array);
|
|
6104
|
+
}, error=>{
|
|
6105
|
+
console.log('error', error);
|
|
6106
|
+
})
|
|
6107
|
+
* @param id_voucher_release_detail
|
|
6108
|
+
* @return Promise => Array<any>
|
|
6109
|
+
*/
|
|
6110
|
+
getVoucherCodes_byIdCouponReleaseDetail(id_voucher_release_detail: any): Promise<unknown>;
|
|
6111
|
+
/**
|
|
6112
|
+
* hàm này trả về danh sách voucher code đã phát hành theo điều kiện query
|
|
6113
|
+
* @example:
|
|
6114
|
+
* this.vhQueryCafe.getVoucherCodes_byFields({status:{$eq: 1}}, {}, {}, 0)
|
|
6115
|
+
.then((res)=>{
|
|
6116
|
+
console.log('getVoucherCodes_byFields', res);
|
|
6117
|
+
}, error=>{
|
|
6118
|
+
console.log('error', error);
|
|
6119
|
+
})
|
|
6120
|
+
* @param query
|
|
6121
|
+
* @param projection
|
|
6122
|
+
* @param sort
|
|
6123
|
+
* @param limit
|
|
6124
|
+
* @return Promise => array(object) = [{},{},..]
|
|
6125
|
+
*/
|
|
6126
|
+
getVoucherCodes_byFields(query: object, projection: object, sort: object, limit: number): Promise<unknown>;
|
|
6127
|
+
/**
|
|
6128
|
+
* hàm này trả về voucher code đã phát hành theo trường _id của voucher code. dùng trong trang bán hàng để đổi phiếu
|
|
6129
|
+
* @example:
|
|
6130
|
+
*
|
|
6131
|
+
* this.vhQueryCafe.getVoucherCode('OUHEDW0512'})
|
|
6132
|
+
.then((res)=>{
|
|
6133
|
+
console.log('getVoucherCode', res);
|
|
6134
|
+
}, error=>{
|
|
6135
|
+
console.log('error', error);
|
|
6136
|
+
})
|
|
6137
|
+
* @param id_voucher_code: cũng chính là code
|
|
6138
|
+
* @return Promise => obj ={} or null
|
|
6139
|
+
*/
|
|
6140
|
+
getVoucherCode(id_voucher_code: any): Promise<unknown>;
|
|
6141
|
+
/**
|
|
6142
|
+
* hàm này trả về voucher code đã phát hành theo trường _id của voucher code.
|
|
6143
|
+
* trả về có cả code, name_voucher, name_voucher_release
|
|
6144
|
+
* @example:
|
|
6145
|
+
*
|
|
6146
|
+
* this.vhQueryCafe.getVoucher_Code_Name_Release('OUHEDW0512'})
|
|
6147
|
+
.then((res)=>{
|
|
6148
|
+
console.log('getVoucher_Code_Name_Release', res);
|
|
6149
|
+
}, error=>{
|
|
6150
|
+
console.log('error', error);
|
|
6151
|
+
})
|
|
6152
|
+
* @param id_voucher_code: cũng chính là code
|
|
6153
|
+
* @return Promise => obj ={} or null
|
|
6154
|
+
*/
|
|
6155
|
+
getVoucher_Code_Name_Release(id_voucher_code: any): Promise<unknown>;
|
|
6156
|
+
/**
|
|
6157
|
+
* hàm này trả về voucher code đã phát hành theo trường code của voucher code. dùng trong trang bán hàng để đổi phiếu,
|
|
6158
|
+
* trả về có cả code, name_voucher, name_voucher_release
|
|
6159
|
+
* @example:
|
|
6160
|
+
*
|
|
6161
|
+
* this.vhQueryCafe.getVoucher_Code_Name_Release_byCode('OUHEDW0512'})
|
|
6162
|
+
.then((res)=>{
|
|
6163
|
+
console.log('getVoucher_Code_Name_Release_byCode', res);
|
|
6164
|
+
}, error=>{
|
|
6165
|
+
console.log('error', error);
|
|
6166
|
+
})
|
|
6167
|
+
* @param code: cũng chính là code
|
|
6168
|
+
* @return Promise => obj ={} or null
|
|
6169
|
+
*/
|
|
6170
|
+
getVoucher_Code_Name_Release_byCode(code: any): Promise<unknown>;
|
|
6171
|
+
exchangeVoucherCode_byEarningPoints(array_id_voucher_code_and_points_and_products: any, id_customer: any, points: any): Promise<unknown>;
|
|
6172
|
+
/**
|
|
6173
|
+
* @example:
|
|
6174
|
+
* let data = {
|
|
6175
|
+
* name :"Thẻ trả trước",
|
|
6176
|
+
* price :1000000,
|
|
6177
|
+
* products : [
|
|
6178
|
+
* {
|
|
6179
|
+
* id_product : 'MOIUHWDWIUHG1345674',
|
|
6180
|
+
* price : 100000,
|
|
6181
|
+
* quantity: 5,
|
|
6182
|
+
* quantity_valid : 5,
|
|
6183
|
+
* type : 1
|
|
6184
|
+
* },{
|
|
6185
|
+
* id_product : 'NJIDUEWNBIJUWGHD135',
|
|
6186
|
+
* price : 100000,
|
|
6187
|
+
* quantity: 5,
|
|
6188
|
+
* quantity_valid : 5,
|
|
6189
|
+
* type : 2
|
|
6190
|
+
* }]
|
|
6191
|
+
* }
|
|
6192
|
+
* this.vhQueryCafe.addPaymentCard(data)
|
|
6193
|
+
.then((res)=>{
|
|
6194
|
+
console.log('addPaymentCard', res);
|
|
6195
|
+
}, error=>{
|
|
6196
|
+
console.log('error', error);
|
|
6197
|
+
})
|
|
6198
|
+
* @param data
|
|
6199
|
+
* @return Promise => Array<any>
|
|
6200
|
+
*/
|
|
6201
|
+
addPaymentCard(data: any): Promise<unknown>;
|
|
6202
|
+
/**
|
|
6203
|
+
* @example:
|
|
6204
|
+
* let data = {
|
|
6205
|
+
* name :"Thẻ trả trước",
|
|
6206
|
+
* price :1000000,
|
|
6207
|
+
* products : [
|
|
6208
|
+
* {
|
|
6209
|
+
* id_product : 'MOIUHWDWIUHG1345674',
|
|
6210
|
+
* price : 100000,
|
|
6211
|
+
* quantity: 5,
|
|
6212
|
+
* quantity_valid : 5,
|
|
6213
|
+
* type : 1
|
|
6214
|
+
* },{
|
|
6215
|
+
* id_product : 'NJIDUEWNBIJUWGHD135',
|
|
6216
|
+
* price : 100000,
|
|
6217
|
+
* quantity: 5,
|
|
6218
|
+
* quantity_valid : 5,
|
|
6219
|
+
* type : 2
|
|
6220
|
+
* }]
|
|
6221
|
+
* }
|
|
6222
|
+
* this.vhQueryCafe.updatePaymentCard(data)
|
|
6223
|
+
.then((bool)=>{
|
|
6224
|
+
console.log('updatePaymentCard', bool);
|
|
6225
|
+
}, error=>{
|
|
6226
|
+
console.log('error', error);
|
|
6227
|
+
})
|
|
6228
|
+
* @param data
|
|
6229
|
+
* @param id_payment_card
|
|
6230
|
+
* @return Promise => bool = true or false
|
|
6231
|
+
*/
|
|
6232
|
+
updatePaymentCard(id_payment_card: any, data: any): Promise<unknown>;
|
|
6233
|
+
/**
|
|
6234
|
+
* @example:
|
|
6235
|
+
* this.vhQueryCafe.deletePaymentCard("9841654DOIWSDYW235")
|
|
6236
|
+
.then((rsp)=>{
|
|
6237
|
+
console.log('deletePaymentCard', rsp);
|
|
6238
|
+
if(rsp.vcode == 0){
|
|
6239
|
+
//phát thông báo xóa thành công
|
|
6240
|
+
}else if(rsp.vcode == 1){
|
|
6241
|
+
//phát thông báo lý do xóa ko thành công (dùng câu từ dễ hiểu với khách hàng)
|
|
6242
|
+
}
|
|
6243
|
+
}, error=>{
|
|
6244
|
+
console.log('error', error);
|
|
6245
|
+
})
|
|
6246
|
+
* @param id_payment_card
|
|
6247
|
+
* @return Promise => rsp = {vcode, message} / error
|
|
6248
|
+
* vcode == 0 : xóa thành công
|
|
6249
|
+
* vcode == 1 : xóa không thành công, do payment_card đã được phát hành, vui lòng xóa đợt phát hành liên quan
|
|
6250
|
+
*/
|
|
6251
|
+
deletePaymentCard(id_payment_card: any): Promise<unknown>;
|
|
6252
|
+
/**
|
|
6253
|
+
* @example:
|
|
6254
|
+
* this.vhQueryCafe.getPaymentCard('FDNOIUWDHIWH21564DWQ')
|
|
6255
|
+
.then((res)=>{
|
|
6256
|
+
console.log('getPaymentCard', res);
|
|
6257
|
+
}, error=>{
|
|
6258
|
+
console.log('error', error);
|
|
6259
|
+
})
|
|
6260
|
+
* @param id_payment_card
|
|
6261
|
+
* @return Promise => object or null
|
|
6262
|
+
*/
|
|
6263
|
+
getPaymentCard(id_payment_card: any): Promise<unknown>;
|
|
6264
|
+
/**
|
|
6265
|
+
* @example:
|
|
6266
|
+
* this.vhQueryCafe.getPaymentCards()
|
|
6267
|
+
.then((res)=>{
|
|
6268
|
+
console.log('getPaymentCards', res);
|
|
6269
|
+
}, error=>{
|
|
6270
|
+
console.log('error', error);
|
|
6271
|
+
})
|
|
6272
|
+
* @return Promise => Array<any>
|
|
6273
|
+
*/
|
|
6274
|
+
getPaymentCards(): Promise<unknown>;
|
|
6275
|
+
/**
|
|
6276
|
+
* @example:
|
|
6277
|
+
* this.vhQueryCafe.addPaymentCardRelease({name : "Đợt phát hành thẻ 1", id_branch :"NIOUHDWLJUNBHIU16549"})
|
|
6278
|
+
.then((res)=>{
|
|
6279
|
+
console.log('addPaymentCardRelease', res);
|
|
6280
|
+
}, error=>{
|
|
6281
|
+
console.log('error', error);
|
|
6282
|
+
})
|
|
6283
|
+
* @param data
|
|
6284
|
+
* @return Promise => object or error
|
|
6285
|
+
*/
|
|
6286
|
+
addPaymentCardRelease(data: any): Promise<unknown>;
|
|
6287
|
+
/**
|
|
6288
|
+
* @example:
|
|
6289
|
+
* this.vhQueryCafe.updatePaymentCardRelease({name : "Đợt phát hành thẻ 1"})
|
|
6290
|
+
.then((bool)=>{
|
|
6291
|
+
console.log('updatePaymentCardRelease', bool);
|
|
6292
|
+
}, error=>{
|
|
6293
|
+
console.log('error', error);
|
|
6294
|
+
})
|
|
6295
|
+
* @param id_payment_card_release
|
|
6296
|
+
* @param data
|
|
6297
|
+
* @return Promise => object or error
|
|
6298
|
+
*/
|
|
6299
|
+
updatePaymentCardRelease(id_payment_card_release: any, data: any): Promise<unknown>;
|
|
6300
|
+
/**
|
|
6301
|
+
* @example:
|
|
6302
|
+
* this.vhQueryCafe.deletePaymentCardRelease("9841654DOIWSDYW235")
|
|
6303
|
+
.then((rsp)=>{
|
|
6304
|
+
console.log('deletePaymentCardRelease', rsp);
|
|
6305
|
+
if(rsp.vcode == 0){
|
|
6306
|
+
//phát thông báo xóa thành công
|
|
6307
|
+
}else if(rsp.vcode == 1){
|
|
6308
|
+
//phát thông báo lý do xóa ko thành công (dùng câu từ dễ hiểu với khách hàng)
|
|
6309
|
+
}
|
|
6310
|
+
}, error=>{
|
|
6311
|
+
console.log('error', error);
|
|
6312
|
+
})
|
|
6313
|
+
* @param id_payment_card_release
|
|
6314
|
+
* @return Promise => rsp = {vcode, message} / error
|
|
6315
|
+
* vcode == 0 : xóa thành công
|
|
6316
|
+
* vcode == 1 : xóa không thành công, do trong đợt phát hành đã có payment_card cần phát hành, vui lòng xóa payment_card khỏi đợt phát hành
|
|
6317
|
+
*/
|
|
6318
|
+
deletePaymentCardRelease(id_payment_card_release: any): Promise<unknown>;
|
|
6319
|
+
/**
|
|
6320
|
+
* @example:
|
|
6321
|
+
* this.vhQueryCafe.getPaymentCardRelease("OIHIDUWNIDOLW123456")
|
|
6322
|
+
.then((res)=>{
|
|
6323
|
+
console.log('getPaymentCardRelease', res);
|
|
6324
|
+
}, error=>{
|
|
6325
|
+
console.log('error', error);
|
|
6326
|
+
})
|
|
6327
|
+
* @param id_payment_card_release
|
|
6328
|
+
* @return Promise => object or null
|
|
6329
|
+
*/
|
|
6330
|
+
getPaymentCardRelease(id_payment_card_release: any): Promise<unknown>;
|
|
6331
|
+
/**
|
|
6332
|
+
* @example:
|
|
6333
|
+
* this.vhQueryCafe.getPaymentCardReleases()
|
|
6334
|
+
.then((res)=>{
|
|
6335
|
+
console.log('getPaymentCardReleases', res);
|
|
6336
|
+
}, error=>{
|
|
6337
|
+
console.log('error', error);
|
|
6338
|
+
})
|
|
6339
|
+
* @return Promise => Array<any>
|
|
6340
|
+
*/
|
|
6341
|
+
getPaymentCardReleases(): Promise<unknown>;
|
|
6342
|
+
/**
|
|
6343
|
+
* @example:
|
|
6344
|
+
* this.vhQueryCafe.addPaymentCardReleaseDetail({id_payment_card : "OIUHFIUWHGGU41698496", id_payment_card_release :"NIOUHDWLJUNBHIU16549"})
|
|
6345
|
+
.then((res)=>{
|
|
6346
|
+
console.log('addPaymentCardReleaseDetail', res);
|
|
6347
|
+
}, error=>{
|
|
6348
|
+
console.log('error', error);
|
|
6349
|
+
})
|
|
6350
|
+
* @param data
|
|
6351
|
+
* @return Promise => object or error
|
|
6352
|
+
*/
|
|
6353
|
+
addPaymentCardReleaseDetail(data: any): Promise<unknown>;
|
|
6354
|
+
/**
|
|
6355
|
+
* @example:
|
|
6356
|
+
* this.vhQueryCafe.deletePaymentCardReleaseDetail("9841654DOIWSDYW235")
|
|
6357
|
+
.then((rsp)=>{
|
|
6358
|
+
console.log('deletePaymentCardReleaseDetail', rsp);
|
|
6359
|
+
if(rsp.vcode == 0){
|
|
6360
|
+
//phát thông báo xóa thành công
|
|
6361
|
+
}else if(rsp.vcode == 1){
|
|
6362
|
+
//phát thông báo lý do xóa ko thành công (dùng câu từ dễ hiểu với khách hàng)
|
|
6363
|
+
}
|
|
6364
|
+
}, error=>{
|
|
6365
|
+
console.log('error', error);
|
|
6366
|
+
})
|
|
6367
|
+
* @param id_payment_card_release_detail
|
|
6368
|
+
* @return Promise => rsp = {vcode, message} / error
|
|
6369
|
+
* vcode == 0 : xóa thành công
|
|
6370
|
+
* vcode == 1 : xóa không thành công, do payment_card_code của đợt phát hành chi tiết này có status !=1 (đã được đổi điểm, hoặc đã sử dụng)
|
|
6371
|
+
*/
|
|
6372
|
+
deletePaymentCardReleaseDetail(id_payment_card_release_detail: any): Promise<unknown>;
|
|
6373
|
+
/**
|
|
6374
|
+
* @example:
|
|
6375
|
+
*
|
|
6376
|
+
* this.vhQueryCafe.getPaymentCardReleaseDetail('FBHYWIBDNIUH1321687')
|
|
6377
|
+
.then((res)=>{
|
|
6378
|
+
console.log('getPaymentCardReleaseDetail', res);
|
|
6379
|
+
}, error=>{
|
|
6380
|
+
console.log('error', error);
|
|
4822
6381
|
})
|
|
4823
|
-
|
|
4824
|
-
|
|
4825
|
-
|
|
4826
|
-
|
|
6382
|
+
* @param id_payment_card_release_detail
|
|
6383
|
+
* @return Promise => object or null
|
|
6384
|
+
*/
|
|
6385
|
+
getPaymentCardReleaseDetail(id_payment_card_release_detail: any): Promise<unknown>;
|
|
6386
|
+
/**
|
|
6387
|
+
* @example:
|
|
6388
|
+
* this.vhQueryCafe.getVoucherRelaseDetail_byFields( {id_payment_card:{$eq: "316OIUHLKMLSDYW235"}}, {}, {}, 0)
|
|
6389
|
+
.then((res)=>{
|
|
6390
|
+
console.log('getVoucherRelaseDetail_byFields', res);
|
|
6391
|
+
}, error=>{
|
|
6392
|
+
console.log('error', error);
|
|
6393
|
+
})
|
|
6394
|
+
* @param query
|
|
6395
|
+
* @param projection
|
|
6396
|
+
* @param sort
|
|
6397
|
+
* @param limit
|
|
6398
|
+
* @return Promise => array(object) = [{},{},..]
|
|
4827
6399
|
*/
|
|
4828
|
-
|
|
6400
|
+
getPaymentCardRelaseDetail_byFields(query: object, projection: object, sort: object, limit: number): Promise<unknown>;
|
|
4829
6401
|
/**
|
|
4830
|
-
|
|
4831
|
-
|
|
4832
|
-
|
|
4833
|
-
|
|
4834
|
-
|
|
4835
|
-
|
|
4836
|
-
|
|
4837
|
-
|
|
4838
|
-
|
|
6402
|
+
* hàm này để phát hành 1 payment_card_code
|
|
6403
|
+
* @example:
|
|
6404
|
+
let data = {
|
|
6405
|
+
date_validity: new Date(),
|
|
6406
|
+
date_expire: new Date(),
|
|
6407
|
+
id_payment_card_release_detail: "fuMS21I6othUm34385WV",
|
|
6408
|
+
id_payment_card: '9841654DOIWSDYW235'
|
|
6409
|
+
}
|
|
6410
|
+
* this.vhQueryCafe.createPaymentCardCode(data)
|
|
6411
|
+
.then((coupon_code)=>{
|
|
6412
|
+
console.log('createPaymentCardCode', coupon_code);
|
|
6413
|
+
}, error=>{
|
|
6414
|
+
console.log('error', error);
|
|
6415
|
+
})
|
|
6416
|
+
* @param data
|
|
6417
|
+
* @return Promise => Object
|
|
6418
|
+
*/
|
|
6419
|
+
private createPaymentCardCode;
|
|
6420
|
+
/**
|
|
6421
|
+
* hàm này để phát hành nhiều payment_card_code theo số lượng truyền vào, và tự động cập nhật trường số lượng đã phát hành (quantity_released) tăng lên
|
|
6422
|
+
* trong collection payment_card_release_details
|
|
6423
|
+
* @example:
|
|
6424
|
+
let data = {
|
|
6425
|
+
date_validity: new Date(),
|
|
6426
|
+
date_expire: new Date(),
|
|
6427
|
+
id_payment_card_release_detail: "fuMS21I6othUm34385WV",
|
|
6428
|
+
id_payment_card: '9841654DOIWSDYW235'
|
|
6429
|
+
}
|
|
6430
|
+
* this.vhQueryCafe.createPaymentCardCodes(data, 10)
|
|
6431
|
+
.then((voucher_codes)=>{
|
|
6432
|
+
console.log('createPaymentCardCodes', voucher_codes);
|
|
6433
|
+
}, error=>{
|
|
6434
|
+
console.log('error', error);
|
|
4839
6435
|
})
|
|
4840
|
-
|
|
4841
|
-
|
|
4842
|
-
|
|
4843
|
-
|
|
6436
|
+
* @param data
|
|
6437
|
+
* @param quantity
|
|
6438
|
+
* @return Promise => Array(object)
|
|
6439
|
+
*/
|
|
6440
|
+
createPaymentCardCodes(data: any, quantity: number): Promise<unknown>;
|
|
6441
|
+
/**
|
|
6442
|
+
* @example:
|
|
6443
|
+
* let data = {
|
|
6444
|
+
date_validity: new Date(),
|
|
6445
|
+
date_expire: new Date(),
|
|
6446
|
+
id_branch: "4zFGhVUAZyj5d09r01xZ"
|
|
6447
|
+
}
|
|
6448
|
+
* this.vhQueryCafe.updatePaymentCardCode('OUHEOIWUYGHIQNIDOUW1359478',data)
|
|
6449
|
+
.then((bool)=>{
|
|
6450
|
+
console.log('updateCouponCode', bool);
|
|
6451
|
+
}, error=>{
|
|
6452
|
+
console.log('error', error);
|
|
6453
|
+
})
|
|
6454
|
+
* @param id_payment_card_code
|
|
6455
|
+
* @param data
|
|
6456
|
+
* @return Promise => boolean = true or false
|
|
4844
6457
|
*/
|
|
4845
|
-
|
|
6458
|
+
updatePaymentCardCode(id_payment_card_code: any, data: any): Promise<unknown>;
|
|
4846
6459
|
/**
|
|
4847
|
-
*
|
|
6460
|
+
* Hàm này chỉ cho phép xóa payment_card đang ở trạng thái đã phát hành (status ==1),
|
|
6461
|
+
* và cập nhật giảm trường số lượng quantity_released bớt một trong collection payment_card_release_details
|
|
4848
6462
|
* @example:
|
|
4849
|
-
|
|
4850
|
-
|
|
4851
|
-
|
|
4852
|
-
|
|
4853
|
-
|
|
4854
|
-
|
|
4855
|
-
* @param
|
|
4856
|
-
* @param
|
|
4857
|
-
* @return
|
|
4858
|
-
* json = {docs(array), empty(boolean), size(number), sales_btax(number), sales_atax(number)}
|
|
4859
|
-
* trong đó docs = [{name(string), id_branch(string), sales_btax(number), sales_atax(number)}]
|
|
6463
|
+
* this.vhQueryCafe.deletePaymentCardCode('OUHEOIWUYGHIQNIDOUW1359478', 'qKgt3cRPRXtw75JV9URp'})
|
|
6464
|
+
.then((bool)=>{
|
|
6465
|
+
console.log('deletePaymentCardCode', bool);
|
|
6466
|
+
}, error=>{
|
|
6467
|
+
console.log('error', error);
|
|
6468
|
+
})
|
|
6469
|
+
* @param id_payment_card_code
|
|
6470
|
+
* @param id_payment_card_release_detail
|
|
6471
|
+
* @return Promise => boolean = true or false
|
|
4860
6472
|
*/
|
|
4861
|
-
|
|
6473
|
+
deletePaymentCardCode(id_payment_card_code: string, id_payment_card_release_detail: string): Promise<unknown>;
|
|
4862
6474
|
/**
|
|
4863
|
-
|
|
4864
|
-
|
|
4865
|
-
|
|
4866
|
-
|
|
4867
|
-
|
|
4868
|
-
|
|
4869
|
-
|
|
4870
|
-
console.log('
|
|
6475
|
+
* hàm này trả về danh sách payment_card_codes đã phát hành theo mỗi đợt
|
|
6476
|
+
* @example:
|
|
6477
|
+
*
|
|
6478
|
+
* this.vhQueryCafe.getPaymentCardCodes_byIdPaymentCardReleaseDetail('OUHEOIWUYGHIQNIDOUW1359478'})
|
|
6479
|
+
.then((array)=>{
|
|
6480
|
+
console.log('getPaymentCardCodes_byIdPaymentCardReleaseDetail', array);
|
|
6481
|
+
}, error=>{
|
|
6482
|
+
console.log('error', error);
|
|
4871
6483
|
})
|
|
4872
|
-
|
|
4873
|
-
|
|
4874
|
-
|
|
4875
|
-
|
|
4876
|
-
getReportSales_Products_byTime_DESC(starttime: any, endtime: any): Promise<any>;
|
|
6484
|
+
* @param id_payment_card_release_detail
|
|
6485
|
+
* @return Promise => Array<any>
|
|
6486
|
+
*/
|
|
6487
|
+
getPaymentCardCodes_byIdPaymentCardReleaseDetail(id_payment_card_release_detail: any): Promise<unknown>;
|
|
4877
6488
|
/**
|
|
4878
|
-
|
|
4879
|
-
|
|
4880
|
-
|
|
4881
|
-
|
|
4882
|
-
|
|
4883
|
-
|
|
4884
|
-
console.log('
|
|
4885
|
-
console.log('reportsales.docs[0]', reportsales.docs[0]);
|
|
6489
|
+
* hàm này trả về danh sách payment_card code đã phát hành theo điều kiện query
|
|
6490
|
+
* @example:
|
|
6491
|
+
* this.vhQueryCafe.getPaymentCardCodes_byFields({status:{$eq: 1}}, {}, {}, 0)
|
|
6492
|
+
.then((res)=>{
|
|
6493
|
+
console.log('getPaymentCardCodes_byFields', res);
|
|
6494
|
+
}, error=>{
|
|
6495
|
+
console.log('error', error);
|
|
4886
6496
|
})
|
|
4887
|
-
|
|
4888
|
-
|
|
4889
|
-
|
|
4890
|
-
|
|
4891
|
-
|
|
6497
|
+
* @param query
|
|
6498
|
+
* @param projection
|
|
6499
|
+
* @param sort
|
|
6500
|
+
* @param limit
|
|
6501
|
+
* @return Promise => array(object) = [{},{},..]
|
|
6502
|
+
*/
|
|
6503
|
+
getPaymentCardCodes_byFields(query: object, projection: object, sort: object, limit: number): Promise<unknown>;
|
|
4892
6504
|
/**
|
|
4893
|
-
|
|
4894
|
-
|
|
4895
|
-
|
|
4896
|
-
|
|
4897
|
-
|
|
6505
|
+
* hàm này trả về payment_card_code đã phát hành theo trường _id của payment_card_code. dùng trong trang bán hàng thanh toán bằng payment_card (chỉ lấy được hàng hóa có và còn trong card)
|
|
6506
|
+
* @example:
|
|
6507
|
+
*
|
|
6508
|
+
* this.vhQueryCafe.getPaymentCardCode('OUHEDW0512'})
|
|
6509
|
+
.then((res)=>{
|
|
6510
|
+
console.log('getPaymentCardCode', res);
|
|
6511
|
+
}, error=>{
|
|
6512
|
+
console.log('error', error);
|
|
4898
6513
|
})
|
|
4899
|
-
* @param
|
|
6514
|
+
* @param id_payment_card_code: cũng chính là code
|
|
6515
|
+
* @return Promise => obj = {} or null
|
|
4900
6516
|
*/
|
|
4901
|
-
|
|
6517
|
+
getPaymentCardCode(id_payment_card_code: any): Promise<unknown>;
|
|
4902
6518
|
/**
|
|
4903
|
-
|
|
4904
|
-
|
|
4905
|
-
|
|
4906
|
-
|
|
4907
|
-
|
|
4908
|
-
|
|
4909
|
-
|
|
4910
|
-
|
|
4911
|
-
|
|
4912
|
-
|
|
6519
|
+
* hàm này trả về payment_card code đã phát hành theo trường _id của payment_card code
|
|
6520
|
+
* trả về có cả code, name_payment_card, name_payment_card_release
|
|
6521
|
+
* @example:
|
|
6522
|
+
*
|
|
6523
|
+
* this.vhQueryCafe.getPaymentCard_Code_Name_Release('OUHEDW0512'})
|
|
6524
|
+
.then((res)=>{
|
|
6525
|
+
console.log('getPaymentCard_Code_Name_Release', res);
|
|
6526
|
+
}, error=>{
|
|
6527
|
+
console.log('error', error);
|
|
6528
|
+
})
|
|
6529
|
+
* @param id_payment_card_code: cũng chính là code
|
|
6530
|
+
* @return Promise => obj ={} or null
|
|
6531
|
+
*/
|
|
6532
|
+
getPaymentCard_Code_Name_Release(id_payment_card_code: any): Promise<unknown>;
|
|
4913
6533
|
/**
|
|
4914
|
-
*
|
|
4915
|
-
*
|
|
4916
|
-
*
|
|
4917
|
-
|
|
4918
|
-
|
|
4919
|
-
|
|
4920
|
-
|
|
4921
|
-
|
|
4922
|
-
|
|
4923
|
-
|
|
4924
|
-
|
|
4925
|
-
|
|
6534
|
+
* hàm này trả về payment_card code đã phát hành theo trường code của payment_card code. dùng trong đưa thẻ mua trước lấy sản phẩm
|
|
6535
|
+
* trả về có cả code, name_payment_card, name_payment_card_release
|
|
6536
|
+
* @example:
|
|
6537
|
+
*
|
|
6538
|
+
* this.vhQueryCafe.getPaymentCard_Code_Name_Release_byCode('OUHEDW0512'})
|
|
6539
|
+
.then((res)=>{
|
|
6540
|
+
console.log('getPaymentCard_Code_Name_Release_byCode', res);
|
|
6541
|
+
}, error=>{
|
|
6542
|
+
console.log('error', error);
|
|
6543
|
+
})
|
|
6544
|
+
* @param code: cũng chính là code
|
|
6545
|
+
* @return Promise => obj ={} or null
|
|
6546
|
+
*/
|
|
6547
|
+
getPaymentCard_Code_Name_Release_byCode(code: any): Promise<unknown>;
|
|
6548
|
+
exchangePaymentCardCode_byEarningPoints(array_id_payment_card_code_and_points_and_products: any, id_customer: any, points: any): Promise<unknown>;
|
|
6549
|
+
/**
|
|
6550
|
+
* không cần hàm này vì khi tạo phiếu bill_type51 đã được cập nhật
|
|
6551
|
+
* hàm này dùng để cập nhật số lượng sản phẩm trong Payment Card khi đổi thẻ
|
|
6552
|
+
* @example:
|
|
6553
|
+
* this.vhQueryCafe.getPaymentCardCode_byCode("ONHDIWUHIODUWN","NDPIUWUHIOUYEW",{quantity_valid: 0})
|
|
6554
|
+
.then((res)=>{
|
|
6555
|
+
console.log('getPaymentCardCode_byCode', res);
|
|
6556
|
+
}, error=>{
|
|
6557
|
+
console.log('error', error);
|
|
6558
|
+
})
|
|
6559
|
+
* @param id_payment_card
|
|
6560
|
+
* @param id_comboproduct
|
|
6561
|
+
* @param data
|
|
6562
|
+
* @return Promise object or null
|
|
6563
|
+
*/
|
|
6564
|
+
updateComboPaymentCard(id_payment_card: any, id_comboproduct: any, data: any): void;
|
|
4926
6565
|
}
|
|
4927
6566
|
export declare class VhQueryCare {
|
|
4928
6567
|
private vhmongo_firebase;
|
|
@@ -11593,16 +13232,19 @@ export declare class VhQuerySales {
|
|
|
11593
13232
|
/**
|
|
11594
13233
|
* Hàm này đổi mảng Bill_Details sang mảng Bill_Details có chương trình khuyến mãi (nếu có)
|
|
11595
13234
|
* @example:
|
|
11596
|
-
*
|
|
13235
|
+
* let date = new Date();
|
|
13236
|
+
* this.vhQuerySales.changeBillDetails_toDisplay(bill_details, date)
|
|
11597
13237
|
.then((bill_details_display)=>{
|
|
11598
|
-
console.log('
|
|
11599
|
-
|
|
13238
|
+
console.log('bill_details_display', res);
|
|
13239
|
+
bill_details = [...bill_details_display];
|
|
13240
|
+
}, error=>{
|
|
11600
13241
|
console.log('error', error);
|
|
11601
13242
|
})
|
|
11602
13243
|
* @param bill_details
|
|
13244
|
+
* @param date : thơi gian tạo hóa đơn
|
|
11603
13245
|
* @return Array => array = [{},{},..]
|
|
11604
13246
|
*/
|
|
11605
|
-
changeBillDetails_toDisplay(bill_details: any):
|
|
13247
|
+
changeBillDetails_toDisplay(bill_details: any, date: any): Promise<unknown>;
|
|
11606
13248
|
/**
|
|
11607
13249
|
* @example:
|
|
11608
13250
|
* this.vhQuerySales.addPromotion_detail({name:'promition 1'})
|
|
@@ -11997,7 +13639,7 @@ export declare class VhQuerySales {
|
|
|
11997
13639
|
*/
|
|
11998
13640
|
getReportDiscount_sales_Customers(starttime: any, endtime: any, IDcustomer: any, IDbranch?: string): Promise<any>;
|
|
11999
13641
|
/**
|
|
12000
|
-
* @Usage :Hàm này dùng trong page HOA HỒNG NHÂN VIÊN -> Chọn TẤT CẢ hoặc MỘT nhân viên
|
|
13642
|
+
* @Usage :Hàm này dùng trong page HOA HỒNG hạng NHÂN VIÊN -> Chọn TẤT CẢ hoặc MỘT nhân viên
|
|
12001
13643
|
* @notice : Mỗi công thức chiết khấu có 5 mức (level1, level2, level3, level4, level5), giá trị doanh số (sales) level sau phải lơn hơn level trước
|
|
12002
13644
|
* type : 1 chiết khấu %, 2 chiết khấu tiền
|
|
12003
13645
|
* method : 1 phương pháp tính theo từng mức, 2 phương pháp tính theo mức cuối
|