public void LoadConfig() { String barCodeTemplate = CommonGlobalCache.GetParameter(ParameterConfigKey.BarCodeTemplate)?.ParaValue; List <String> list = JGNet.Server.Tools.DataHelper.StringToList(barCodeTemplate); foreach (var item in this.Controls) { if (item is CheckBox) { CheckBox box = item as CheckBox; box.Checked = false; if (list.Contains(box.Tag.ToString())) { box.Checked = true; } } } }
private void PrintRetail(RetailOrder retailOrder) { OrderPrintUtil printHelper = new OrderPrintUtil(); List <RetailDetail> retailDetailList = CommonGlobalCache.ServerProxy.GetRetailDetailList(retailOrder.ID); foreach (var item in retailDetailList) { Costume costume = CommonGlobalCache.GetCostume(item.CostumeID); // 显示自己设置的尺码组和对应的尺码列表 item.SizeDisplayName = CostumeStoreHelper.GetCostumeSizeName(item.SizeName, CommonGlobalCache.GetSizeGroup(costume.SizeGroupName)); } RetailCostume retailCostume = new RetailCostume() { RetailDetailList = retailDetailList, RetailOrder = retailOrder }; int times = CommonGlobalUtil.ConvertToInt32(CommonGlobalCache.GetParameter(ParameterConfigKey.PrintCount).ParaValue); DataGridView dgv = deepCopyDataGridView(); printHelper.Print(retailCostume, times, dgv); }
public void Print_page(object sender, PrintPageEventArgs e) { Graphics g = e.Graphics; //获得绘图对象 Font font = new Font(new FontFamily("微软雅黑"), 8); Font boldFont = new Font(new FontFamily("微软雅黑"), 8, FontStyle.Bold); Font boldFontBig = new Font(new FontFamily("微软雅黑"), 11); float linesPerPage = 0; int count = 0; //行计数器 float leftMargin = e.MarginBounds.Left + 20; //左边距 float topMargin = e.MarginBounds.Top; //上边距 string line = null; //行字符串 SolidBrush myBrush = new SolidBrush(Color.Black); //刷子 linesPerPage = e.MarginBounds.Height / font.GetHeight(g); StringBuilder sb = new StringBuilder(); float tabF = leftMargin; //获取配置信息 String template = CommonGlobalCache.GetParameter(ParameterConfigKey.BarCodeTemplate)?.ParaValue; List <String> settings = DataHelper.StringToList(template); line = string.Empty; String lineB = string.Empty; String lineC = string.Empty; if (settings.Contains("BrandName")) { lineB = info.BrandName; } if (settings.Contains("CostumeID")) { lineC = info.CostumeID; } if (!String.IsNullOrEmpty(lineB)) { line += lineB; if (!String.IsNullOrEmpty(lineC)) { line += "/" + lineC; } } else { if (!String.IsNullOrEmpty(lineC)) { line = lineC; } } g.DrawString(line, font, myBrush, tabF, topMargin + (count) * font.GetHeight(g)); tabF += 100; line = string.Empty; if (settings.Contains("ClassName")) { line = info.ClassName; } g.DrawString(line, font, myBrush, tabF, topMargin + (count++) * font.GetHeight(g)); tabF = leftMargin; line = string.Empty; if (settings.Contains("Remarks")) { line = info.Remarks; } g.DrawString(line, font, myBrush, tabF, topMargin + (count++) * font.GetHeight(g)); line = string.Empty; if (settings.Contains("BarCode")) { line = info.BarCode; Bitmap map = BarcodeHelper.Generate(ZXing.BarcodeFormat.CODE_128, line, 140, 50); g.DrawImage(map, tabF, topMargin + (count++) * font.GetHeight(g)); } tabF = leftMargin; count++; count++; count++; line = string.Empty; if (settings.Contains("CostumeName")) { line = info.CostumeName; } g.DrawString(line, font, myBrush, tabF, topMargin + (count) * font.GetHeight(g)); tabF += 100; line = string.Empty; if (settings.Contains("ColorName")) { line = info.ColorName; } g.DrawString(line, font, myBrush, tabF, topMargin + (count++) * font.GetHeight(g)); line = string.Empty; if (settings.Contains("SalePrice")) { line = "¥" + info.SalePrice.ToString(); } tabF = leftMargin; g.DrawString(line, font, myBrush, tabF, topMargin + (count) * font.GetHeight(g)); tabF += 100; line = string.Empty; if (settings.Contains("SizeName")) { line = info.SizeName; } g.DrawString(line, font, myBrush, tabF, topMargin + (count++) * font.GetHeight(g)); }
private void BaseButton_OK_Click(object sender, EventArgs e) { try { if (GlobalUtil.EngineUnconnectioned(this)) { return; } if (this.refundCostume.RefundOrder.TotalCount == 0) { GlobalMessageBox.Show("退货数量为0,不能退货"); return; } if (Math.Abs(skinLabel_TotalMoney.Value) != (skinLabel_RefundIntegration.Value + skinLabel_RefundStoredCard.Value + skinLabel_RefundCash.Value + this.numericTextBoxBankCard.Value + this.numericTextBoxWeixin.Value + this.numericTextBoxAlipay.Value + this.numericTextBoxElse.Value )) { GlobalMessageBox.Show("退款总额必须与总计相等!"); return; } this.refundCostume.RefundOrder.MoneyIntegration = skinLabel_RefundIntegration.Value * -1; this.refundCostume.RefundOrder.MoneyVipCard = skinLabel_RefundStoredCard.Value * -1; this.refundCostume.RefundOrder.MoneyCash = skinLabel_RefundCash.Value * -1; this.refundCostume.RefundOrder.MoneyAlipay = numericTextBoxAlipay.Value * -1; this.refundCostume.RefundOrder.MoneyOther = numericTextBoxElse.Value * -1; this.refundCostume.RefundOrder.MoneyWeiXin = numericTextBoxWeixin.Value * -1; this.refundCostume.RefundOrder.MoneyBankCard = numericTextBoxBankCard.Value * -1; // decimal moneyVipCardDonate = this.refundCostume.RefundOrder.MoneyVipCard * (decimal)member.DonateCoef; // decimal moneyVipCardMain = this.refundCostume.RefundOrder.MoneyVipCard * (1 - (decimal)member.DonateCoef); if (!String.IsNullOrEmpty(refundCostume.RefundOrder.MemeberID)) { Member member = CommonGlobalCache.ServerProxy.GetOneMember(refundCostume.RefundOrder.MemeberID); if (member != null) { decimal moneyVipCardMain = refundCostume.RefundOrder.MoneyVipCard * (decimal)(1.0 - member.DonateCoef); refundCostume.RefundOrder.MoneyCash2 = refundCostume.RefundOrder.MoneyCash; refundCostume.RefundOrder.MoneyVipCardMain = moneyVipCardMain; refundCostume.RefundOrder.MoneyVipCardDonate = refundCostume.RefundOrder.MoneyVipCard * (decimal)(member.DonateCoef); } } else { refundCostume.RefundOrder.MoneyCash2 = refundCostume.RefundOrder.MoneyCash; refundCostume.RefundOrder.MoneyVipCardMain = 0; refundCostume.RefundOrder.MoneyVipCardDonate = 0; } if (refundCostume.RefundOrder.IsNotPay) { decimal total = 0; foreach (RetailDetail curDetail in this.refundCostume.RefundDetailList) { foreach (RetailDetail keepDetail in keepCostume.RefundDetailList) { if (curDetail.RetailOrderID == keepDetail.RetailOrderID && curDetail.CostumeID == keepDetail.CostumeID && curDetail.ColorName == keepDetail.ColorName && curDetail.SizeName == keepDetail.SizeName) { curDetail.SumMoney = keepDetail.SumMoney; total += keepDetail.SumMoney; } } } refundCostume.RefundOrder.TotalMoneyReceived = total * -1; } else { //总计=现金+积分+VIP卡+优惠券 //这笔单的应收金额 - (不退的那几件以原价* 数量 -满减金额) - (退的那几件)优惠券 refundCostume.RefundOrder.TotalMoneyReceived = refundCostume.RefundOrder.MoneyCash + refundCostume.RefundOrder.MoneyIntegration + refundCostume.RefundOrder.MoneyVipCard + this.refundCostume.RefundOrder.MoneyAlipay + this.refundCostume.RefundOrder.MoneyOther + this.refundCostume.RefundOrder.MoneyWeiXin + this.refundCostume.RefundOrder.MoneyBankCard; refundCostume.RefundOrder.TotalMoneyReceivedActual = refundCostume.RefundOrder.MoneyCash + this.refundCostume.RefundOrder.MoneyAlipay + this.refundCostume.RefundOrder.MoneyOther + this.refundCostume.RefundOrder.MoneyWeiXin + this.refundCostume.RefundOrder.MoneyBankCard + refundCostume.RefundOrder.MoneyVipCardMain + (refundCostume.RefundOrder.RetailMoneyDeductedByTicket - refundCostume.RefundOrder.MoneyDeductedByTicket); refundCostume.RefundOrder.Benefit = refundCostume.RefundOrder.TotalMoneyReceivedActual - refundCostume.RefundOrder.TotalCost; //平摊 if (refundCostume.RefundDetailList != null) { CalcDirectly(); } //总计=现金+积分+VIP卡+优惠券 //这笔单的应收金额 - (不退的那几件以原价* 数量 -满减金额) - (退的那几件)优惠券 // refundCostume.RefundOrder.TotalMoneyReceived = refundCostume.RefundOrder.MoneyCash + refundCostume.RefundOrder.MoneyIntegration + refundCostume.RefundOrder.MoneyVipCard; } refundCostume.RefundOrder.ShopID = this.ShopID; InteractResult result = GlobalCache.ServerProxy.RefundCostume(this.refundCostume); if (result.ExeResult == ExeResult.Success) { GlobalMessageBox.Show("退货成功!"); this.DialogResult = DialogResult.OK; if (skinCheckBoxPrint.Checked) { RefundOrderPrintUtil printHelper = new RefundOrderPrintUtil(); int times = CommonGlobalUtil.ConvertToInt32(CommonGlobalCache.GetParameter(ParameterConfigKey.PrintCount).ParaValue); DataGridView dgv = deepCopyDataGridView(); printHelper.Print(refundCostume, times, dgv); } } else if (result.ExeResult == ExeResult.Error) { GlobalMessageBox.Show(result.Msg); } } catch (Exception ee) { GlobalUtil.WriteLog(ee); GlobalMessageBox.Show("内部错误,退货失败!"); } finally { GlobalUtil.UnLockPage(this); } }