新增老板专属私域运营概况与订单新老客户统计
This commit is contained in:
1 parent
000a80af3c
commit
d18089aaf6
21 files changed
+248
-79
No files matched your search
+3
-3
@@ -96,7 +96,7 @@ function quote(ledger,input,actor,env,{creating=false,orderId=null,existingRecov
|
||||
const note=env.text(input.note,'备注',240,true),payer=ledger.validateMember(input.payer??member,'回收付款人',{original:existingRecovery?.payer});
|
||||
const payment_account=env.paymentAccount(input.payment_account||'麦麦微信',{original:existingRecovery?.payment_account});
|
||||
const credit_card_rate_permille=existingRecovery?(existingRecovery.credit_card_rate_permille??(orderId?CreditCardRates.read(ledger,'order',orderId):CreditCardFees.ratePermille)):CreditCardRates.current(ledger);
|
||||
const result={mode,date,customer,salesperson,member,note,old_lines,oldMg,oldPocket,...(oldStockCount===null?{}:{oldStockCount}),credit_card_rate_permille,newMg:0,matchedMg:0,differenceMg:0,surplusMg:mode==='direct'?oldMg:0,
|
||||
const result={mode,date,customer,customer_type:require('./private-operations').customerType(input.customer_type),salesperson,member,note,old_lines,oldMg,oldPocket,...(oldStockCount===null?{}:{oldStockCount}),credit_card_rate_permille,newMg:0,matchedMg:0,differenceMg:0,surplusMg:mode==='direct'?oldMg:0,
|
||||
goldRate:0,laborRate:0,laborMode:'gram',depreciationRate:0,depreciationMg:0,goldAmount:0,laborAmount:0,depreciationAmount:0,
|
||||
charges:[],chargesAmount:0,discount:0,rounding_mode:'cent',rounding_adjustment:0,receivable:0,payer,payment_account,
|
||||
materialCost:0,laborCost:0,goodsCost:0,directCost:0,profit:0};
|
||||
@@ -174,14 +174,14 @@ function nextNumber(ledger,date,env){
|
||||
const key='recovery-sequence',seq=ledger.meta(key,0)+1;if(!Number.isSafeInteger(seq))env.fail('回收单号超出支持范围');
|
||||
ledger.setMeta(key,seq);return 'HS'+date.replaceAll('-','')+String(seq).padStart(4,'0');
|
||||
}
|
||||
function orderInput(q){if(q.newProducts){const first=orderInput(productParts(q)[0]);return {...first,discount:amountInput(q.discount),rounding_mode:q.rounding_mode,payment_account:q.payment_account,fee_items:q.exchange.fee_items.map(f=>({...f,amount:amountInput(f.amount)})),lines:productParts(q).flatMap(part=>orderInput(part).lines)};}return {date:q.date,member:q.member,customer:q.customer,salesperson:q.salesperson,note:q.note,
|
||||
function orderInput(q){if(q.newProducts){const first=orderInput(productParts(q)[0]);return {...first,discount:amountInput(q.discount),rounding_mode:q.rounding_mode,payment_account:q.payment_account,fee_items:q.exchange.fee_items.map(f=>({...f,amount:amountInput(f.amount)})),lines:productParts(q).flatMap(part=>orderInput(part).lines)};}return {date:q.date,member:q.member,customer:q.customer,customer_type:q.customer_type,salesperson:q.salesperson,note:q.note,
|
||||
lines:[{name:q.newProduct.name,unit:'g',quantity:weightInput(q.newMg),pocket:q.newProduct.pocket,...(q.newProduct.stockCount==null?{}:{stockCount:q.newProduct.stockCount}),payer:q.exchange.costPayer,costPayers:q.exchange.costPayers,
|
||||
pricingMode:'manual',sale:amountInput(q.goldAmount+q.laborAmount+q.depreciationAmount),charges:q.charges.map(charge=>({...charge,amount:amountInput(charge.amount)})),
|
||||
costParts:{material:amountInput(q.materialCost??0),labor:amountInput(q.laborCost),accessories:'0',other:'0'},
|
||||
priceNote:`补金 ${weightInput(q.differenceMg)}克 × ${amountInput(q.goldRate)}元;新货工费 ${amountInput(q.laborAmount)}元;折旧 ${amountInput(q.depreciationAmount)}元`}],
|
||||
discount:amountInput(q.discount),rounding_mode:q.rounding_mode,payment_account:q.payment_account,fee_items:q.exchange.fee_items.map(fee=>({...fee,amount:amountInput(fee.amount)}))};}
|
||||
function inputFor(q){
|
||||
const input={mode:q.mode,date:q.date,customer:q.customer,salesperson:q.salesperson,member:q.member,note:q.note,
|
||||
const input={mode:q.mode,date:q.date,customer:q.customer,customer_type:q.customer_type,salesperson:q.salesperson,member:q.member,note:q.note,
|
||||
old_pocket:q.oldPocket??'回收旧料',...(q.oldStockCount==null?{}:{old_stock_count:q.oldStockCount}),
|
||||
old_lines:q.old_lines.map(line=>({name:line.name,incoming_weight:weightInput(line.incomingMg),melted_weight:weightInput(line.meltedMg),purity:String(line.purity)})),
|
||||
buy_rate:amountInput(q.buyRate),buy_total:amountInput(q.purchaseAmount),payer:q.payer,payment_account:q.payment_account,verified:true};
|
||||
|
||||
Reference in new issue
Block a user