/// <summary> /// 打印 实物券 / 预付 使用情况 /// </summary> private void xrTableCell16_BeforePrint(object sender, System.Drawing.Printing.PrintEventArgs e) { XRTableCell cell = sender as XRTableCell; if (cell == null) { return; } int index = (int)(this._skuIndex - 1); if (index >= this.dataSource.ReportDetails.Count) { return; } SODetailReportEntity detail = this.dataSource.ReportDetails[index]; // 当前商品的实物券(用券量) int phy_count = this.dataSource.GetAttrCountBySku(ConvertUtil.ToInt(detail.MaterialCode), 2).Count; if (phy_count == 0) { cell.Text = string.Empty; } else { decimal out_result = 0.00m; decimal.TryParse(detail.PickQtyReportStr, out out_result); decimal returnCount = phy_count - out_result; if (returnCount < 0) { returnCount = 0; } cell.Text = string.Format("{0}\r\n{1:f0}", phy_count, returnCount); } }
/// <summary> /// 打印 实物券 / 预付 使用情况 /// </summary> private void xrTableCell16_BeforePrint(object sender, System.Drawing.Printing.PrintEventArgs e) { XRTableCell cell = sender as XRTableCell; if (cell == null) { return; } int index = (int)(this._skuIndex - 1); if (index >= this.dataSource.ReportDetails.Count) { return; } SODetailReportEntity detail = this.dataSource.ReportDetails[index]; int phy_count = this.dataSource.GetAttrCountBySku(ConvertUtil.ToInt(detail.MaterialCode), 2).Count; // 实物券 int pay_count = this.dataSource.GetAttrCountBySku(ConvertUtil.ToInt(detail.MaterialCode), 4).Sum(u => ConvertUtil.ToInt(u.Num)); // 预付 if (phy_count == 0 && pay_count == 0) { cell.Text = string.Empty; } else { cell.Text = string.Format("{0}\r\n{1}", phy_count, pay_count); } }
/// <summary> /// 打印 预付名称 /// </summary> private void xrTableCell2_BeforePrint(object sender, System.Drawing.Printing.PrintEventArgs e) { XRTableCell cell = sender as XRTableCell; if (cell == null) { return; } int index = (int)(this._skuIndex - 1); if (index >= this.dataSource.ReportDetails.Count) { return; } SODetailReportEntity detail = this.dataSource.ReportDetails[index]; if (this.dataSource.PaymentUsedGroup.Count > 0) // 如果存在预付 { // 根据当前商品找到对应的预付 SODetailAttributeEntity attr = this.dataSource.PaymentList.Find( new Predicate <SODetailAttributeEntity>((item) => { return(ConvertUtil.ToString(item.SkuCode) == detail.MaterialCode); })); if (attr == null) { this.xrTableCell2.Text = string.Empty; } else { if (attr.YuFuName == null) { return; } // 当前商品的预付量 int pay_count = this.dataSource.GetAttrCountBySku(ConvertUtil.ToInt(detail.MaterialCode), 4).Sum(u => ConvertUtil.ToInt(u.Num)); int lastIndex = attr.YuFuName.LastIndexOf("预付款"); if (lastIndex < 1) { return; } this.xrTableCell2.Text = string.Format("{0}\r\n{1}", pay_count, attr.YuFuName.Substring(0, lastIndex)); } } }
public RepSO1(int billID, short copies) : this() { BillID = billID; this.copies = copies; //获取数据 try { header = soDal.GetHeaderInfoByBillID(BillID); List <SODetailReportEntity> reportDetails = soDal.GetDetailsForPrint(BillID); List <SODetailAttributeEntity> detailAttri = soDal.GeDetailAttri(BillID); // 该订单所有优惠券 List <SODetailAttributeEntity> tempList = new List <SODetailAttributeEntity>(); // 满足条件的优惠券 2015-07-08 彭伟[添加] dataSource = new SOBody(); dataSource.CompanyInfo = new CompanyDal().GetCompanys()[0]; dataSource.Header = header; dataSource.ReportDetails = reportDetails; dataSource.ReportDetailAttri = tempList; List <SODetailReportEntity> reportDetailCopy = new List <SODetailReportEntity>(); if (reportDetailCopy.Count > 0) { reportDetailCopy.Add(reportDetails[0]); } dataSource.ReportDetailCopy = reportDetailCopy; int numRow = 0;// 记录应该加几行空白 decimal nomalTotal = 0; decimal nomalAmount = reportDetails.Sum(u => u.PickQtyReport); decimal attriAmount = 0.00M; if (detailAttri.Count == 0) { GroupHeader1.Visible = false; Detail2.Visible = false; numRow = 10; } else { #region 2015-07-08 彭伟[添加/修改] // 筛选符合条件的优惠券 foreach (SODetailAttributeEntity item in detailAttri) { // 找出有优惠券的商品 SODetailReportEntity detail = reportDetails.Find(new Predicate <SODetailReportEntity>((d) => { return(d.MaterialCode == ConvertUtil.ToString(item.SkuCode)); })); if (detail != null && detail.PickQty > 0) { // 计算使用的优惠券是否已经达到拣货量 decimal count = tempList.Count(new Func <SODetailAttributeEntity, bool>((d) => { return(ConvertUtil.ToString(d.SkuCode) == detail.MaterialCode); })); if (count < detail.PickQtyReport) { tempList.Add(item); } } } if (tempList.Count > 0) { attriAmount = tempList.Sum(u => u.SellPrice); //attriAmount = detailAttri.Sum(u => u.SellPrice); numRow = 13; } else { GroupHeader1.Visible = false; Detail2.Visible = false; numRow = 10; } #endregion } nomalTotal = nomalAmount + attriAmount - header.PayedAmount;//实物金额-实物劵(负数)- 已支付金额; lblNormal.Text = nomalAmount.ToString(); lblAttriTotal.Text = attriAmount.ToString(); lblPayedAmount.Text = header.PayedAmount.ToString(); if (nomalTotal < 0) { this.xrLabel14.Text = "0.00"; this.xrLabel26.Visible = this.xrLabel27.Visible = true; this.xrLabel27.Text = Math.Abs(nomalTotal).ToString(); } else { this.xrLabel26.Visible = this.xrLabel27.Visible = false; xrLabel14.Text = nomalTotal.ToString(); } soDal.SaveReceiveAmount(BillID, nomalTotal); //判断是否是新客户 int ret = ConvertUtil.ToInt(soDal.GetCustomerIsNew(header.CustomerCode)); if (ret <= 1) { xrLabel15.Visible = true; } //dataSource.Customer = new CustomerDal().GetByCode(header.Customer); lblDate.Text = DateTime.Now.ToString("yyyy-MM-dd HH:mm:dd"); lblWarehouse.Text = GlobeSettings.LoginedUser.WarehouseName; decimal n = 0; foreach (SODetailReportEntity entity in reportDetails) { decimal num = Math.Ceiling(ConvertUtil.ToDecimal(entity.SkuCombName.Length) / ConvertUtil.ToDecimal(12)); if (num > 1) { n += num - 1; } } this.PageHeight = (reportDetails.Count + ConvertUtil.ToInt(n + numRow) + tempList.Count) * 63 + 800; xrLabel2.Text = this.soDal.GetVhicleNo(header.BillID); } catch (Exception ex) { MsgBox.Err(ex.Message); } }