|
|
@ -20,6 +20,7 @@ using System.Web.UI.HtmlControls; |
|
|
using System.Web.UI.WebControls; |
|
|
using System.Web.UI.WebControls; |
|
|
using TSingSoft.WebControls2; |
|
|
using TSingSoft.WebControls2; |
|
|
using TSingSoft.WebPluginFramework; |
|
|
using TSingSoft.WebPluginFramework; |
|
|
|
|
|
using BWP.B3_YunKen; |
|
|
|
|
|
|
|
|
namespace BWP.Web.Pages.B3YunKen.Dialogs |
|
|
namespace BWP.Web.Pages.B3YunKen.Dialogs |
|
|
{ |
|
|
{ |
|
|
@ -163,24 +164,66 @@ namespace BWP.Web.Pages.B3YunKen.Dialogs |
|
|
|
|
|
|
|
|
var ids = Ids.Split(',').Where(x => !string.IsNullOrEmpty(x)).Select(long.Parse).ToList(); |
|
|
var ids = Ids.Split(',').Where(x => !string.IsNullOrEmpty(x)).Select(long.Parse).ToList(); |
|
|
var nextID = VerificationUtil.GetNextID(context); |
|
|
var nextID = VerificationUtil.GetNextID(context); |
|
|
|
|
|
|
|
|
foreach (var id in ids) |
|
|
|
|
|
{ |
|
|
|
|
|
var gathering = new Gathering(); |
|
|
|
|
|
|
|
|
var onlineConfig = new B3YunKenOnlineConfiguration(); |
|
|
|
|
|
if (onlineConfig.UseOneGathering && ids.Count == 1) { |
|
|
|
|
|
var id = ids[0]; |
|
|
var gatheringMoney = InnerBLUtil.GetDmoPropertyByID<Gathering, Money<金额>?>(context.Session, "GatheringMoney", id); |
|
|
var gatheringMoney = InnerBLUtil.GetDmoPropertyByID<Gathering, Money<金额>?>(context.Session, "GatheringMoney", id); |
|
|
var verificationMoney = InnerBLUtil.GetDmoPropertyByID<Gathering, Money<金额>?>(context.Session, "VerificationMoney", id); |
|
|
var verificationMoney = InnerBLUtil.GetDmoPropertyByID<Gathering, Money<金额>?>(context.Session, "VerificationMoney", id); |
|
|
var tMoney = (gatheringMoney ?? 0) - (verificationMoney ?? 0); |
|
|
var tMoney = (gatheringMoney ?? 0) - (verificationMoney ?? 0); |
|
|
if (tMoney <= 0) |
|
|
|
|
|
continue; |
|
|
|
|
|
if (money <= 0) |
|
|
|
|
|
continue; |
|
|
|
|
|
if (money < tMoney) |
|
|
|
|
|
{ |
|
|
|
|
|
tMoney = money; |
|
|
|
|
|
} |
|
|
|
|
|
money -= tMoney; |
|
|
|
|
|
|
|
|
var gathering = new Gathering(); |
|
|
gathering.ID = id; |
|
|
gathering.ID = id; |
|
|
VerificationUtil.Insert(context, gathering, tMoney, nextID); |
|
|
|
|
|
|
|
|
foreach (var item in selectItems) { |
|
|
|
|
|
var billMoney = ((decimal?)item["本次核销金额"]) ?? 0; |
|
|
|
|
|
|
|
|
|
|
|
if (tMoney <= 0) |
|
|
|
|
|
continue; |
|
|
|
|
|
if (billMoney <= 0) |
|
|
|
|
|
continue; |
|
|
|
|
|
if (billMoney <= tMoney) { |
|
|
|
|
|
|
|
|
|
|
|
tMoney -= billMoney; |
|
|
|
|
|
var billType = item["单据类型"] == null ? "销售出库单" : item["单据类型"].ToString(); |
|
|
|
|
|
short billTypeId; |
|
|
|
|
|
if (billType == "销售发票") { |
|
|
|
|
|
billTypeId = DmoTypeIDAttribute.GetID(typeof(Invoice)); |
|
|
|
|
|
} else if (billType == "客户验收单") { |
|
|
|
|
|
billTypeId = DmoTypeIDAttribute.GetID(typeof(CustomerAccept)); |
|
|
|
|
|
} else if (billType == "其他应收款") { |
|
|
|
|
|
billTypeId = DmoTypeIDAttribute.GetID(typeof(OtherReceivables)); |
|
|
|
|
|
} else { |
|
|
|
|
|
billTypeId = DmoTypeIDAttribute.GetID(typeof(SaleOutStore)); |
|
|
|
|
|
} |
|
|
|
|
|
var billId = (long)item["ID"]; |
|
|
|
|
|
var customer_Detail = new InvoiceInfo(); |
|
|
|
|
|
customer_Detail.Gathering_ID = gathering.ID; |
|
|
|
|
|
customer_Detail.BillID = billId; |
|
|
|
|
|
customer_Detail.BillMoney = (Money<金额>?)item["金额"]; |
|
|
|
|
|
customer_Detail.DmoTypeID = billTypeId; |
|
|
|
|
|
customer_Detail.Date = (DateTime?)item["单据日期"]; |
|
|
|
|
|
customer_Detail.AlreadyMoney = (Money<金额>?)item["VerificationMoney"]; |
|
|
|
|
|
customer_Detail.Customer_ID = CustomerID; |
|
|
|
|
|
customer_Detail.Money = billMoney; |
|
|
|
|
|
context.Session.Insert(customer_Detail); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
VerificationUtil.Insert(context, gathering, money, nextID); |
|
|
|
|
|
} else { |
|
|
|
|
|
foreach (var id in ids) { |
|
|
|
|
|
var gathering = new Gathering(); |
|
|
|
|
|
var gatheringMoney = InnerBLUtil.GetDmoPropertyByID<Gathering, Money<金额>?>(context.Session, "GatheringMoney", id); |
|
|
|
|
|
var verificationMoney = InnerBLUtil.GetDmoPropertyByID<Gathering, Money<金额>?>(context.Session, "VerificationMoney", id); |
|
|
|
|
|
var tMoney = (gatheringMoney ?? 0) - (verificationMoney ?? 0); |
|
|
|
|
|
if (tMoney <= 0) |
|
|
|
|
|
continue; |
|
|
|
|
|
if (money <= 0) |
|
|
|
|
|
continue; |
|
|
|
|
|
if (money < tMoney) { |
|
|
|
|
|
tMoney = money; |
|
|
|
|
|
} |
|
|
|
|
|
money -= tMoney; |
|
|
|
|
|
gathering.ID = id; |
|
|
|
|
|
VerificationUtil.Insert(context, gathering, tMoney, nextID); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
foreach (var row in _browseGrid.GetSelectedItems()) |
|
|
foreach (var row in _browseGrid.GetSelectedItems()) |
|
|
@ -245,6 +288,16 @@ namespace BWP.Web.Pages.B3YunKen.Dialogs |
|
|
hPanel.Add(_selectMoneyLabel); |
|
|
hPanel.Add(_selectMoneyLabel); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//private bool IsExistInvoiceInfo(TransactionContext context,short billTypeId,long billId,long gatheringId)
|
|
|
|
|
|
//{
|
|
|
|
|
|
// var query = new DQueryDom(new JoinAlias(typeof(InvoiceInfo)));
|
|
|
|
|
|
// query.Columns.Add(DQSelectColumn.Field("ID"));
|
|
|
|
|
|
// query.Where.Conditions.Add(DQCondition.EQ("DmoTypeID",billTypeId));
|
|
|
|
|
|
// query.Where.Conditions.Add(DQCondition.EQ("BillID", billId));
|
|
|
|
|
|
// query.Where.Conditions.Add(DQCondition.EQ("Gathering_ID", gatheringId));
|
|
|
|
|
|
// return query.EExecuteScalar<long>(context.Session) != null?true:false;
|
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
private void CreateQueryGrid(TitlePanelZone zone) |
|
|
private void CreateQueryGrid(TitlePanelZone zone) |
|
|
{ |
|
|
{ |
|
|
var result = new TitlePanel(B3FrameworksConsts.PageLayouts.QueryResult, B3FrameworksConsts.PageLayouts.QueryResult_DisplayName); |
|
|
var result = new TitlePanel(B3FrameworksConsts.PageLayouts.QueryResult, B3FrameworksConsts.PageLayouts.QueryResult_DisplayName); |
|
|
@ -388,6 +441,7 @@ namespace BWP.Web.Pages.B3YunKen.Dialogs |
|
|
dom.Columns.Add(DQSelectColumn.Field("ID")); |
|
|
dom.Columns.Add(DQSelectColumn.Field("ID")); |
|
|
dom.Columns.Add(DQSelectColumn.Field("AccountingUnit_Name")); |
|
|
dom.Columns.Add(DQSelectColumn.Field("AccountingUnit_Name")); |
|
|
dom.Columns.Add(DQSelectColumn.Field("VerificationMoney")); |
|
|
dom.Columns.Add(DQSelectColumn.Field("VerificationMoney")); |
|
|
|
|
|
dom.Columns.Add(DQSelectColumn.Create(DQExpression.Field("AccountCustomer_ID"), "AccountCustomer_ID")); |
|
|
dom.Columns.Add(DQSelectColumn.Create(DQExpression.Field(customerNameField), "结账客户")); |
|
|
dom.Columns.Add(DQSelectColumn.Create(DQExpression.Field(customerNameField), "结账客户")); |
|
|
dom.Columns.Add(DQSelectColumn.Create(DQExpression.Field(moneyField), "金额")); |
|
|
dom.Columns.Add(DQSelectColumn.Create(DQExpression.Field(moneyField), "金额")); |
|
|
dom.Columns.Add(DQSelectColumn.Create(DQExpression.Field(moneyField).ESubtract(DQExpression.Field("VerificationMoney")), "本次核销金额")); |
|
|
dom.Columns.Add(DQSelectColumn.Create(DQExpression.Field(moneyField).ESubtract(DQExpression.Field("VerificationMoney")), "本次核销金额")); |
|
|
|