您好,请您先 登陆 或者 注册

手工抹零金额过多,销售额中不能减掉摸零的金额

有一客户,把手工抹零当成优惠,给一租赁供应商的商品进行手工抹零,金额较大,导致现在给供应商结账不能查询真实销售。望更新一下。可以按供应商查询到消售了哪些单品抹零金额为多少。以便给客户正确向供应商结账。特急!在线等待。

问题补充:关键是销售了多个供应商的,需要把抹零金额的,商品按供应商分开,按支付查询出来的不能按供应商查询。无法给供应商销售款,不是为了单纯查抹零总金额。

提问者: nylp0626
等级:普通会员
时间:2012-08-12 16:54
悬赏:0
解决时间:2012-08-20 21:13
最佳答案
该问题已解决,明天上传语句给大家。

--将手工抹零金额分摊回单据及单据明细;
declare @sheet_no varchar(20),@ml_amt numeric(18,2),@pos_total_amt numeric(18,2),@rate numeric(18,6)
declare cur_sheet cursor for
select sheet_no,pos_total_amt from t_pos_sale_master where pos_status ='9'
open cur_sheet
fetch cur_sheet into @sheet_no,@pos_total_amt
while @@fetch_status =0
begin
select @ml_amt = IsNull(sum(payment_amt * coin_rate),0.00) from t_pos_sale_payment where sheet_no=@sheet_no and payment_no ='34'
if @ml_amt <= 0.00 goto next_
if @pos_total_amt<= 0.00 goto next_

select @rate = (@pos_total_amt - @ml_amt) / @pos_total_amt

update t_pos_sale_detail set sale_amt = round(sale_amt * @rate,2),real_price =round((sale_amt * @rate)/sale_qty,6) where sheet_no =@sheet_no

delete t_pos_sale_payment where sheet_no=@sheet_no and payment_no ='34'
update t_pos_sale_master set pos_total_amt = pos_total_amt - @ml_amt where sheet_no=@sheet_no

next_:
fetch cur_sheet into @sheet_no,@pos_total_amt
end
close cur_sheet
deallocate cur_sheet

go

declare @sheet_no varchar(20),@ml_amt numeric(18,2),@pos_total_amt numeric(18,2),@rate numeric(18,6)
declare cur_sheet1 cursor for
select sheet_no,pos_total_amt from t_pos_sale_master_fore where pos_status ='9'
open cur_sheet1
fetch cur_sheet1 into @sheet_no,@pos_total_amt
while @@fetch_status =0
begin
select @ml_amt = IsNull(sum(payment_amt * coin_rate),0.00) from t_pos_sale_payment_fore where sheet_no=@sheet_no and payment_no ='34'
if @ml_amt <= 0.00 goto next_
if @pos_total_amt<= 0.00 goto next_

select @rate = (@pos_total_amt - @ml_amt) / @pos_total_amt

update t_pos_sale_detail_fore set sale_amt = round(sale_amt * @rate,2),real_price =round((sale_amt * @rate)/sale_qty,6) where sheet_no =@sheet_no

delete t_pos_sale_payment_fore where sheet_no=@sheet_no and payment_no ='34'
update t_pos_sale_master_fore set pos_total_amt = pos_total_amt - @ml_amt where sheet_no=@sheet_no

next_:
fetch cur_sheet1 into @sheet_no,@pos_total_amt
end
close cur_sheet1
deallocate cur_sheet1

go

仅用于一单一商品情况下,一单多商品情况下不支持。
回答者:李祥
等级:问不倒翁
时间:2012-08-20 00:30
您觉得最佳答案好不好?
目前有 1 个人评价
100% (1)
不好 0% (0)
对最佳答案的评论 共 1 条
那前台抹不了零,怎么搞?
评论者:伤势
其它回答 共 6 条
期待高手解决
回答者:kh359
等级:问不倒翁
时间:2012-08-12 18:11
可以在前台零售查询里面,单据支付报表里面可以找到抹零数据!
回答者:赢通技术3
等级:皇冠会员
时间:2012-08-13 09:50

回答者:pioneer
等级:金牌会员
时间:2012-08-13 10:32
前台零售查询里面,单据支付报表里面可以找到抹零数据!
回答者:zhaoshuai888
等级:问不倒翁
时间:2012-08-14 00:12
二楼对的。
回答者:wangze2005
等级:问不倒翁
时间:2012-08-15 07:46
看二楼
回答者:55774883
等级:钻石会员
时间:2012-08-15 20:05
对最佳答案的评论:

评论字数200字以内
快到期问题
总积分排行
ytkf00720058 4704
kh35927124 3414
赢通技术43602 3117
bonchen13219 2797
赢通技术37615 2590
JCLH11087 1917
浅逝1873 1873
李祥19958 1542
xiaobird3309 1254
daoptt3310 1237