Esempio n. 1
0
 public RepSOTransfer(SOBody body, string module)
     : this()
 {
     this.dataSource = body;
     this._module    = module;
     try
     {
         //判断是否是新客户
         int ret = ConvertUtil.ToInt(soDal.GetCustomerIsNew(this.dataSource.Header.CustomerCode));
         lblDate.Text      = DateTime.Now.ToString("yyyy-MM-dd HH:mm:dd");
         lblWarehouse.Text = GlobeSettings.LoginedUser.WarehouseName;
         decimal n = 0;
         foreach (SODetailReportEntity entity in this.dataSource.ReportDetails)
         {
             decimal num = Math.Ceiling(ConvertUtil.ToDecimal(entity.SkuCombName.Length) / ConvertUtil.ToDecimal(14.5));
             if (num >= 2)
             {
                 n += num;
             }
         }
         //2015-7-18 彭伟
         decimal bodyHeight = (this.dataSource.ReportDetails.Count) * 63.5m + n * 18.5m;
         this.PageHeight = ConvertUtil.ToInt(760 + bodyHeight);//1021
         xrLabel2.Text   = this.soDal.GetVhicleNo(this.dataSource.Header.BillID);
     }
     catch (Exception ex)
     {
         MsgBox.Err(ex.Message);
     }
 }
Esempio n. 2
0
        public RepAsnReturn(SOBody body)
            : this()
        {
            this.dataSource = body;

            //获取数据
            try
            {
                dataSource.CompanyInfo = new CompanyDal().GetCompanys()[0];
                lblReturnAmount.Text   = body.TotalAmount.ToString("f2");

                lblDate.Text      = DateTime.Now.ToString("yyyy-MM-dd");
                lblWarehouse.Text = GlobeSettings.LoginedUser.WarehouseName;
                this.PageHeight   = body.ReportDetails.Count * 63 + 1150;
            }
            catch (Exception ex)
            {
                MsgBox.Err(ex.Message);
            }
        }
Esempio n. 3
0
 public RepSO_New2(SOBody body, string module)
     : this()
 {
     this.dataSource = body;
     this._module    = module;
     try
     {
         List <SOFooterReportEntity> footer2 = new List <SOFooterReportEntity>();
         // 应收金额 (如果应收金额为负数表示惠付通需返回余额)
         decimal amount = this.dataSource.AmountReceivable;
         this.xrTableCell12.Text = this.dataSource.BillAmount.ToString("f2");
         this.xrTableCell18.Text = this.dataSource.TotalAmount.ToString("f2");
         if (this.dataSource.PhysicalBondList.Count > 0) // 实物券
         {
             this.dataSource.ReportFooter1.Add(new SOFooterReportEntity(
                                                   "已使用实物券:", Math.Abs(this.dataSource.PhysicalBondList.Sum(u => u.SellPrice)).ToString("f2")));
         }
         if (this.dataSource.PaymentList.Count > 0)  // 预付
         {
             foreach (SODetailAttributeEntity item in this.dataSource.PaymentList)
             {
                 decimal value = Math.Abs(item.SellPrice);
                 this.dataSource.ReportFooter1.Add(new SOFooterReportEntity(
                                                       string.Format("已使用{0}预付款:", item.YuFuName), value.ToString("f2")));
                 amount -= value;
             }
         }
         if (this.dataSource.CashList.Count > 0)     // 现金券
         {
             this.dataSource.ReportFooter1.Add(new SOFooterReportEntity(
                                                   "已使用代金券:", this.dataSource.CashAmountStr));
             amount -= this.dataSource.CashAmount;
         }
         if (this.dataSource.SuitList.Count > 0)
         {
             foreach (SODetailAttributeEntity entity in this.dataSource.SuitList)
             {
                 decimal value = Math.Abs(ConvertUtil.ToInt(entity.Num) * entity.SellPrice);
                 amount -= value;
                 this.dataSource.ReportFooter1.Insert(0, new SOFooterReportEntity(
                                                          entity.YuFuName + "(套餐)优惠:", value.ToString("f2")));
             }
         }
         if (this.dataSource.HuiFuList.Count > 0)    // 惠付通
         {
             foreach (SODetailAttributeEntity item in this.dataSource.HuiFuList)
             {
                 decimal value = Math.Abs(item.SellPrice);
                 amount -= value;
                 this.dataSource.ReportFooter1.Add(new SOFooterReportEntity(
                                                       "已支付金额(惠付通):", value.ToString("f2")));
             }
         }
         else
         {
             if (this.dataSource.Header.PayedAmount > 0)
             {
                 amount -= this.dataSource.Header.PayedAmount;
                 this.dataSource.ReportFooter1.Add(new SOFooterReportEntity(
                                                       "已支付金额(惠付通):", this.dataSource.Header.PayedAmountStr));
             }
         }
         if (this.dataSource.CardList.Count > 0)
         {
             foreach (SODetailAttributeEntity item in this.dataSource.CardList)
             {
                 decimal value = Math.Abs(item.SellPrice);
                 amount -= value;
                 this.dataSource.ReportFooter1.Add(new SOFooterReportEntity(
                                                       "已支付金额(刷卡):", value.ToString("f2")));
             }
         }
         if (this.dataSource.AlipayList.Count > 0)
         {
             foreach (SODetailAttributeEntity item in this.dataSource.AlipayList)
             {
                 decimal value = Math.Abs(item.SellPrice);
                 amount -= value;
                 this.dataSource.ReportFooter1.Add(new SOFooterReportEntity(
                                                       "已支付金额(支付宝):", value.ToString("f2")));
             }
         }
         if (this.dataSource.BianMinList.Count > 0)
         {
             foreach (SODetailAttributeEntity item in this.dataSource.BianMinList)
             {
                 decimal value = Math.Abs(item.SellPrice);
                 amount -= value;
                 this.dataSource.ReportFooter1.Add(new SOFooterReportEntity(
                                                       "已支付金额(便民账户):", value.ToString("f2")));
             }
         }
         if (amount < 0)
         {
             footer2.Insert(0, new SOFooterReportEntity("应收合计:", "0.00"));
             footer2.Insert(footer2.Count - 1, (new SOFooterReportEntity(
                                                    "惠付通余额应退回:", Math.Abs(amount).ToString("0.00"))));
             amount = 0;
         }
         else
         {
             footer2.Insert(0, new SOFooterReportEntity("应收合计:", Math.Abs(amount).ToString("f2")));
         }
         this.dataSource.ReportFooter2.AddRange(footer2);
         soDal.SaveReceiveAmount(body.Header.BillID, amount);
         //判断是否是新客户
         int ret = ConvertUtil.ToInt(soDal.GetCustomerIsNew(this.dataSource.Header.CustomerCode));
         if (ret <= 1)
         {
             xrLabel15.Visible = true;
         }
         lblDate.Text      = DateTime.Now.ToString("yyyy-MM-dd HH:mm:dd");
         lblWarehouse.Text = GlobeSettings.LoginedUser.WarehouseName;
         decimal n = 0;
         foreach (SODetailReportEntity entity in this.dataSource.ReportDetails)
         {
             decimal num = Math.Ceiling(ConvertUtil.ToDecimal(entity.SkuCombName.Length) / ConvertUtil.ToDecimal(12));
             if (num > 2)
             {
                 n += num;
             }
         }
         decimal footHeight = (this.dataSource.ReportFooter2.Count + this.dataSource.ReportFooter1.Count) * 70;
         decimal bodyHeight = (this.dataSource.ReportDetails.Count + n) * 90;
         this.PageHeight = ConvertUtil.ToInt(ConvertUtil.ToDecimal(this.TopMargin.HeightF +
                                                                   this.BottomMargin.HeightF + this.ReportHeader.HeightF + this.ReportHeader1.HeightF +
                                                                   this.ReportHeader2.HeightF + this.ReportFooter.HeightF) + footHeight + bodyHeight) + 100;
         xrLabel2.Text = this.soDal.GetVhicleNo(this.dataSource.Header.BillID);
     }
     catch (Exception ex)
     {
         MsgBox.Err(ex.Message);
     }
 }
Esempio n. 4
0
 public RepSO(SOBody body)
     : this()
 {
     this.dataSource = body;
     try
     {
         List <SOFooterReportEntity> footer2 = new List <SOFooterReportEntity>();
         //int numRow = 0;// 记录应该加几行空白
         this.dataSource.ReportFooter1.Add(new SOFooterReportEntity()
         {
             Value1 = "下单金额:",
             Value2 = this.dataSource.BillAmount.ToString("0.00"),
             Value3 = "出货合计:",
             Value4 = this.dataSource.TotalAmount.ToString("0.00")
         });
         if (this.dataSource.PhysicalBondList.Count > 0)         //有实物券
         {
             this.dataSource.ReportFooter1.Add(new SOFooterReportEntity(
                                                   "已使用实物券:", Math.Abs(this.dataSource.PhysicalBondList.Sum(u => u.SellPrice)).ToString("0.00")));
         }
         // 应收金额 (如果应收金额为负数表示惠付通需返回余额)
         decimal amount = this.dataSource.AmountReceivable;
         #region  预付
         if (this.dataSource.PaymentUsedGroup.Count > 0)
         {
             foreach (string item in this.dataSource.PaymentUsedGroup.Keys)
             {
                 string[] keys = item.Split('_');
                 if (keys == null && keys.Length != 2)
                 {
                     continue;
                 }
                 decimal num = this.dataSource.PaymentUsedGroup[item];
                 List <SODetailAttributeEntity> payList = this.dataSource.PaymentList.FindAll(
                     u => ConvertUtil.ToString(u.SkuCode) == keys[1] && u.BillID == ConvertUtil.ToInt(keys[0])
                     );
                 if (payList == null || payList.Count == 0)
                 {
                     continue;
                 }
                 decimal payNum = payList.Sum(u => ConvertUtil.ToInt(u.Num));
                 this.dataSource.ReportFooter1.Add(new SOFooterReportEntity(
                                                       string.Format("已使用{0}:", payList[0].YuFuName),
                                                       Math.Abs(payNum * payList[0].SellPrice).ToString("0.00")));
                 SODetailAttributeEntity attr = this.dataSource.PaymentList.Find(
                     new Predicate <SODetailAttributeEntity>((at) =>
                 {
                     return(at.BillID == ConvertUtil.ToInt(keys[0]) &&
                            ConvertUtil.ToString(at.SkuCode) == keys[1]);
                 }));
                 if (attr == null)
                 {
                     continue;
                 }
                 decimal phy = attr.SellPrice * num;
                 if (num < 0)// 小于零表示需要退预付
                 {
                     footer2.Add(new SOFooterReportEntity(
                                     string.Format("{0}已退回:", attr.YuFuName),
                                     Math.Abs(phy).ToString("0.00")));
                     amount += ((payNum + num) * attr.SellPrice);
                 }
                 else
                 {
                     amount += payNum * attr.SellPrice;
                 }
             }
         }
         #endregion
         if (this.dataSource.Header.PayedAmount > 0)
         {
             this.dataSource.ReportFooter1.Add(new SOFooterReportEntity(
                                                   "已支付金额(惠付通):", this.dataSource.Header.PayedAmountStr));
         }
         if (amount < 0)     // 有惠付通余额返回
         {
             footer2.Insert(0, new SOFooterReportEntity("应收合计:", "0.00"));
             if (this.dataSource.PhyReturnList.Count > 0)        // 有实物券返回
             {
                 footer2.Insert(1, new SOFooterReportEntity(
                                    "实物券已退回:",
                                    string.Format("{0} 张", this.dataSource.PhyReturnList.Count)));
             }
             footer2.Add(new SOFooterReportEntity("惠付通余额已退回:", Math.Abs(amount).ToString("0.00")));
             amount = 0;
         }
         else
         {
             footer2.Insert(0, new SOFooterReportEntity("应收合计:", amount.ToString("0.00")));
             if (this.dataSource.PhyReturnList.Count > 0)        // 有实物券返回
             {
                 footer2.Insert(1, new SOFooterReportEntity(
                                    "实物券已退回:",
                                    string.Format("{0} 张", this.dataSource.PhyReturnList.Count)));
             }
         }
         this.dataSource.ReportFooter2.AddRange(footer2);
         soDal.SaveReceiveAmount(body.Header.BillID, amount);
         //判断是否是新客户
         int ret = ConvertUtil.ToInt(soDal.GetCustomerIsNew(this.dataSource.Header.CustomerCode));
         if (ret <= 1)
         {
             xrLabel15.Visible = true;
         }
         lblDate.Text      = DateTime.Now.ToString("yyyy-MM-dd HH:mm:dd");
         lblWarehouse.Text = GlobeSettings.LoginedUser.WarehouseName;
         decimal n = 0;
         foreach (SODetailReportEntity entity in this.dataSource.ReportDetails)
         {
             //Size size = TextRenderer.MeasureText(entity.SkuCombName, this.xrTableCell13.Font);
             //n += (int)(size.Width * 3.5 / this.xrTableCell13.WidthF);
             decimal num = Math.Ceiling(ConvertUtil.ToDecimal(entity.SkuCombName.Length) / ConvertUtil.ToDecimal(12));
             if (num > 2)
             {
                 n += num;
             }
         }
         //2015-7-18 彭伟
         decimal footHeight = (this.dataSource.ReportFooter2.Count + this.dataSource.ReportFooter1.Count) * 70;
         decimal bodyHeight = (this.dataSource.ReportDetails.Count + n) * 90;
         this.PageHeight = ConvertUtil.ToInt(1030 + footHeight + bodyHeight);//1021
         //this.PageHeight = (this.dataSource.ReportDetails.Count + ConvertUtil.ToInt(n + numRow) + this.dataSource.ReportDetailAttri.Count) * 63 + 800;
         xrLabel2.Text = this.soDal.GetVhicleNo(this.dataSource.Header.BillID);
     }
     catch (Exception ex)
     {
         MsgBox.Err(ex.Message);
     }
 }
Esempio n. 5
0
        public RepSO_New(SOBody body, string module)
            : this()
        {
            this.dataSource = body;
            this._module    = module;
            try
            {
                List <SOFooterReportEntity> footer2 = new List <SOFooterReportEntity>();
                // 应收金额 (如果应收金额为负数表示惠付通需返回余额)
                decimal amount = this.dataSource.AmountReceivable;

                this.dataSource.ReportFooter1.Add(new SOFooterReportEntity()
                {
                    Value1 = "下单金额:",
                    Value2 = this.dataSource.BillAmount.ToString("0.00"),
                    Value3 = "出货合计:",
                    Value4 = this.dataSource.TotalAmount.ToString("0.00")
                });
                if (this.dataSource.PhysicalBondList.Count > 0)
                {
                    this.dataSource.ReportFooter1.Add(new SOFooterReportEntity(
                                                          "已使用实物券:", Math.Abs(this.dataSource.PhysicalBondList.Sum(u => u.SellPrice)).ToString("f2")));
                }
                #region  预付
                if (this.dataSource.PaymentUsedGroup.Count > 0)
                {
                    foreach (string item in this.dataSource.PaymentUsedGroup.Keys)
                    {
                        string[] keys = item.Split('_');
                        if (keys == null && keys.Length != 2)
                        {
                            continue;
                        }
                        decimal num = this.dataSource.PaymentUsedGroup[item];
                        List <SODetailAttributeEntity> payList = this.dataSource.PaymentList.FindAll(
                            u => ConvertUtil.ToString(u.SkuCode) == keys[1] && u.BillID == ConvertUtil.ToInt(keys[0])
                            );
                        if (payList == null || payList.Count == 0)
                        {
                            continue;
                        }
                        decimal payNum = payList.Sum(u => ConvertUtil.ToInt(u.Num));
                        this.dataSource.ReportFooter1.Add(new SOFooterReportEntity(
                                                              string.Format("已使用{0}:", payList[0].YuFuName),
                                                              Math.Abs(payNum * payList[0].SellPrice).ToString("0.00")));
                        SODetailAttributeEntity attr = this.dataSource.PaymentList.Find(
                            new Predicate <SODetailAttributeEntity>((at) =>
                        {
                            return(at.BillID == ConvertUtil.ToInt(keys[0]) &&
                                   ConvertUtil.ToString(at.SkuCode) == keys[1]);
                        }));
                        if (attr == null)
                        {
                            continue;
                        }
                        decimal phy = attr.SellPrice * num;
                        if (num < 0)// 小于零表示需要退预付
                        {
                            footer2.Add(new SOFooterReportEntity(
                                            string.Format("{0}应退回:", attr.YuFuName),
                                            Math.Abs(phy).ToString("0.00")));
                            amount += ((payNum + num) * attr.SellPrice);
                        }
                        else
                        {
                            amount += payNum * attr.SellPrice;
                        }
                    }
                }
                #endregion
                if (this.dataSource.CashList.Count > 0)
                {
                    this.dataSource.ReportFooter1.Add(new SOFooterReportEntity(
                                                          "已使用代金券:", this.dataSource.CashAmountStr));
                }
                if (this.dataSource.Header.PayedAmount > 0)
                {
                    this.dataSource.ReportFooter1.Add(new SOFooterReportEntity(
                                                          string.Format("已支付金额({0}):", this.dataSource.Header.PayMethodStr),
                                                          this.dataSource.Header.PayedAmountStr));
                }
                if (this.dataSource.PhyReturnList.Count > 0)        // 有实物券返回
                {
                    footer2.Insert(0, new SOFooterReportEntity(
                                       "实物券应退回:",
                                       string.Format("{0} 张", this.dataSource.PhyReturnList.Count)));
                }
                if (amount < 0)     // 有惠付通或者代金券返回(无需再计算 惠付通 或者 代金券)
                {
                    footer2.Insert(0, new SOFooterReportEntity("应收合计:", "0.00"));
                    if (this.dataSource.CashList.Count > 0)
                    {
                        footer2.Add(new SOFooterReportEntity("代金券应退回:", this.dataSource.CashAmountStr));
                    }
                    footer2.Insert(footer2.Count - 1, (new SOFooterReportEntity(
                                                           string.Format("{0}余额应退回:", this.dataSource.Header.PayMethodStr),
                                                           Math.Abs(amount).ToString("0.00"))));
                    amount = 0;
                }
                else                                          // 表示剩下金额应从 惠付通 或者 代金券 里扣除
                {
                    if (this.dataSource.CashAmount <= amount) // 直接抵扣,剩下金额使用已支付金额抵扣
                    {
                        amount -= (this.dataSource.CashAmount + this.dataSource.Header.PayedAmount);
                        if (amount < 0)
                        {
                            footer2.Insert(0, new SOFooterReportEntity("应收合计:", "0.00"));
                            footer2.Add(new SOFooterReportEntity(
                                            string.Format("{0}支付应退回:", this.dataSource.Header.PayMethodStr),
                                            Math.Abs(amount).ToString("0.00")));
                            amount = 0;
                        }
                        else
                        {
                            footer2.Insert(0, new SOFooterReportEntity("应收合计:", Math.Abs(amount).ToString("0.00")));
                        }
                    }
                    else                                     // 计算在代金券里可使用的合理值(不能超过当前应收金额)
                    {
                        // 找出应退的[代金券]额度
                        decimal        cashDiff  = this.dataSource.CashAmount - amount; // 现金券差
                        List <decimal> cashList  = new List <decimal>();
                        decimal        cashValue = 0.00m;                               // 应退 代金券 额度
                        for (int i = 0; i < this.dataSource.CashList.Count; i++)
                        {
                            cashValue = this.dataSource.CashList[i].SellPrice;
                            for (int j = 0; j < this.dataSource.CashList.Count; j++)
                            {
                                if (this.dataSource.CashList[i] == this.dataSource.CashList[j])
                                {
                                    continue;
                                }
                                else if (cashValue >= cashDiff)
                                {
                                    if (!cashList.Contains(cashValue))
                                    {
                                        cashList.Add(cashValue);
                                    }
                                    cashValue = this.dataSource.CashList[j].SellPrice;
                                }
                                else
                                {
                                    cashValue += this.dataSource.CashList[j].SellPrice;
                                }
                            }
                        }
                        if (cashList.Count > 0)
                        {
                            cashValue = cashList.Min();
                        }
                        cashValue = Math.Abs(cashValue);
                        amount   -= (this.dataSource.CashAmount - cashValue);
                        // 剩下的钱用 已支付 扣除
                        decimal result = this.dataSource.Header.PayedAmount - Math.Abs(amount);
                        if (result < 0)
                        {
                            footer2.Insert(0, new SOFooterReportEntity("应收合计:", Math.Abs(result).ToString("f2")));
                            footer2.Add(new SOFooterReportEntity("代金券应退回:", Math.Abs(cashValue).ToString("f2")));
                        }
                        else
                        {
                            footer2.Insert(0, new SOFooterReportEntity("应收合计:", "0.00"));
                            footer2.Add(new SOFooterReportEntity("代金券应退回:", Math.Abs(cashValue).ToString("f2")));
                            footer2.Add(new SOFooterReportEntity(
                                            string.Format("{0}支付应退回:", this.dataSource.Header.PayMethodStr),
                                            result.ToString("f2")));
                            amount = 0;
                        }
                    }
                }
                this.dataSource.ReportFooter2.AddRange(footer2);
                soDal.SaveReceiveAmount(body.Header.BillID, amount);
                //判断是否是新客户
                int ret = ConvertUtil.ToInt(soDal.GetCustomerIsNew(this.dataSource.Header.CustomerCode));
                if (ret <= 1)
                {
                    xrLabel15.Visible = true;
                }
                lblDate.Text      = DateTime.Now.ToString("yyyy-MM-dd HH:mm:dd");
                lblWarehouse.Text = GlobeSettings.LoginedUser.WarehouseName;
                decimal n = 0;
                foreach (SODetailReportEntity entity in this.dataSource.ReportDetails)
                {
                    decimal num = Math.Ceiling(ConvertUtil.ToDecimal(entity.SkuCombName.Length) / ConvertUtil.ToDecimal(12));
                    if (num > 2)
                    {
                        n += num;
                    }
                }
                //2015-7-18 彭伟
                decimal footHeight = (this.dataSource.ReportFooter2.Count + this.dataSource.ReportFooter1.Count) * 70;
                decimal bodyHeight = (this.dataSource.ReportDetails.Count + n) * 90;
                this.PageHeight = ConvertUtil.ToInt(1030 + footHeight + bodyHeight);//1021
                xrLabel2.Text   = this.soDal.GetVhicleNo(this.dataSource.Header.BillID);
            }
            catch (Exception ex)
            {
                MsgBox.Err(ex.Message);
            }
        }
Esempio n. 6
0
        public void PrintSO()
        {
            List <SOHeaderEntity> focusedBills = IParent.GetFocusedBills();

            if (focusedBills.Count == 0)
            {
                MsgBox.Warn("请选中要打印的单据。");
                return;
            }
            foreach (SOHeaderEntity entity in focusedBills)
            {
                int status = ConvertUtil.ToInt(entity.Status);
                if (status != 68 && status != 693)
                {
                    MsgBox.Warn(String.Format("只有订单状态为<发货完成>或<已发车>后才能在此打印单据。"));
                    return;
                }
            }

            if (MsgBox.AskOK(string.Format("一共选中了“{0}”个单据“{1}”,确定要开始打印吗?",
                                           focusedBills.Count, GetBillNOs(focusedBills))) != DialogResult.OK)
            {
                return;
            }
            SOBody dataSource = null;
            //CompanyEntity company = new CompanyDal().GetCompanys()[0];        whc 2016-11-14 16:32:43
            bool   printed        = false;
            int    pick_suit_type = ConvertUtil.ToInt(GlobeSettings.SystemSettings["套餐分拣方式"]);
            string module         = "出库单管理";

            NewPrint.sellorder sellOrder = new NewPrint.sellorder();
            //sellOrder.printorder(string.Format("{0}#{1}", GlobeSettings.LoginedUser.WarehouseName, StringUtil.JoinBySign<SOHeaderEntity>(focusedBills, "BillNO", ";")));
            //return;
            foreach (SOHeaderEntity header in focusedBills)
            {
                sellOrder.printorder(string.Format("{0}#{1}",
                                                   GlobeSettings.LoginedUser.WarehouseName, header.BillNO));
                #region 现已不采用
                //dataSource = new SOBody();
                //#region 采购退货注释
                ////if (header.BillType == "124")
                ////{
                ////    if (header.Status == BaseCodeConstant.SO_STATUS_CLOSE)  // 如果状态为“发货完成”,打印单据
                ////    {
                ////        dataSource.Header = header;
                ////        dataSource.CompanyInfo = company;
                ////        dataSource.ReportDetails = soDal.GetDetailsForPrint(header.BillID);

                ////        RepAsnReturn repSO = new RepAsnReturn(dataSource);
                ////        //repSO.ShowPreviewDialog();
                ////        repSO.Print();
                ////        printed = true;
                ////    }
                ////    else
                ////    {
                ////        MsgBox.Warn(string.Format("单据:{0} 发货完成后才能打印。"));
                ////    }
                ////}
                ////else
                ////{
                //#endregion
                //dataSource.Header = header;
                //dataSource.CompanyInfo = company;
                //dataSource.ReportDetails = soDal.GetDetailsForPrint(header.BillID, pick_suit_type);
                //dataSource.ReportDetailAttri = soDal.GeDetailAttri(header.BillID);   // 该订单所有优惠券
                //XtraReport repSO = null;
                //if (header.BillType == "121" || header.BillType == "122" || header.BillType == "123")
                //{
                //    repSO = new RepSOTransfer(dataSource, module);
                //}
                //else if (header.BillType == "125")
                //{
                //    repSO = new RepSOBreakage(dataSource, module);
                //}
                //else if (pick_suit_type == 0)
                //{
                //    repSO = new RepSO_New(dataSource, module);
                //}
                //else if (pick_suit_type == 1)
                //{
                //    repSO = new RepSO_New2(dataSource, module);
                //}
                //repSO.ShowPreviewDialog();
                ////repSO.Print();
                #endregion
                printed = true;
                //}
                if (printed)
                {
                    //更新打印标记为已打印
                    UpdatePrintedFlag(header.BillID, GlobeSettings.LoginedUser.UserName, header.BillNO, 0);
                    header.Printed = 1;
                    //Insert(ELogType.打印, GlobeSettings.LoginedUser.UserName, header.BillNO, header.BillTypeName, "出库单管理");
                }
            }

            IParent.RefreshHeaderGrid();
        }
Esempio n. 7
0
        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);
            }
        }