private void btnSearch_Click(object sender, EventArgs e) { ShouYi data = new ShouYi(); data.TicketID = this.txtTicketID.Text; data.UserID = this.txtUserID.Text; data.UserName = this.txtUserName.Text; data.PhoneNo = this.txtPhoneNo.Text; var list = UccRuntime.Dop.Select(data, "", "QuYiDateTime ASC", 0, 0); this.Bind(list); }
public void Bind(ShouYi data) { this.txtTicketID.Text = data.TicketID; this.datePutIn.Text = data.ShouYiDateTime.ToString("yyyy年MM月dd日"); this.datePutOut.Text = data.QuYiDateTime.ToString("yyyy年MM月dd日"); this.cbxMoneyState.Text = data.MoneyState; this.cbxPutWay.Text = data.PutWay; this.txtThisMoney.Text = data.Price; User user = new User(); if(!string.IsNullOrEmpty(data.UserID)) { user.UserID = data.UserID; user = UccRuntime.Dop.SelectSingle(user) as User; this.txtUserID.Text = user.UserID; this.txtUserName.Text = user.UserName; this.txtAddress.Text = user.Address; this.txtMoney.Text = user.Money.ToString(); this.txtPhone.Text = user.PhoneNo; } else { this.txtUserName.Text = data.UserName; this.txtAddress.Text = data.Address; this.txtPhone.Text = data.PhoneNo; } YiFuList = new List<YiFu>(); YiFu yifu = new YiFu(); yifu.TicketID = data.TicketID; YiFuList = UccRuntime.Dop.Select(yifu, "", "", 0, 0); foreach (var item in YiFuList) { this.lbxYiFu.Items.Add(item.ClotheID.PadRight(30) + item.ClotheType); } }
public double GetMoney(ShouYi ticket, List<YiFu> yiFuList) { double sum = 0; double dazhe = 0; foreach (var item in yiFuList) { YiFuPriceType pinpai = new YiFuPriceType(); pinpai.YiFuName = item.ClotheType; pinpai = UccRuntime.Dop.SelectSingle(pinpai) as YiFuPriceType; if (pinpai != null) { if (pinpai.IsZheKou > 0) dazhe += double.Parse(item.Price); else sum += double.Parse(item.Price); } else { sum += double.Parse(item.Price); } } return sum + dazhe * 0.1 * ticket.ZheKou; }
public ShouYi GetTicket() { var ticket = new ShouYi(); ticket.TicketID = this.txtTicketID.Text; ticket.UserID = this.txtUserID.Text; ticket.UserName = this.txtUserName.Text; ticket.PhoneNo = this.txtPhone.Text; ticket.Address = this.txtAddress.Text; ticket.PutWay = this.cbxPutWay.SelectedItem.ToString(); ticket.Price = this.txtThisMoney.Text; ticket.State = "未洗"; ticket.MoneyState = this.cbxMoneyState.Text; ticket.ShouYiDateTime = DateTime.Parse(this.datePutIn.Text); ticket.QuYiDateTime = DateTime.Parse(this.datePutOut.Text); ticket.ZheKou = double.Parse(this.cbxZheKou.SelectedItem.ToString()); return ticket; }
private void btnShouKuan_Click(object sender, EventArgs e) { try { MoneyHistory history = new MoneyHistory(); history.MoneyID = "M" + DateTime.Now.ToString("yyyyMMdd") + UccRuntime.Dop.Count<MoneyHistory>(); history.Money = string.IsNullOrEmpty(this.txtMoney.Text) ? 0 : -double.Parse(this.txtThisMoney.Text); history.MoneyTime = DateTime.Now; User user = new User(); if (!string.IsNullOrEmpty(this.txtUserID.Text)) { user.UserID = this.txtUserID.Text; user = UccRuntime.Dop.SelectSingle(user) as User; history.BeforeMoney = user.Money; history.UserID = user.UserID; history.UserName = user.UserName; user.Money += history.Money; } else { user.UserName = this.txtUserName.Text; } Ticket.TicketID = this.txtTicketID.Text; Ticket = UccRuntime.Dop.SelectSingle(Ticket) as ShouYi; Ticket.MoneyState = "已付"; this.cbxMoneyState.Text = "已付"; UccRuntime.Dop.Insert(history); if (user != null) UccRuntime.Dop.Update(user); UccRuntime.Dop.Update(Ticket); MessageBox.Show("操作成功!"); } catch(Exception ex) { MessageBox.Show("操作失败!"+ex.Message); } }
private void btnOk_Click(object sender, EventArgs e) { try { this.Ticket = new ShouYi(); Ticket.TicketID = this.txtTicketID.Text; Ticket = UccRuntime.Dop.SelectSingle(Ticket) as ShouYi; if (Ticket == null) { MessageBox.Show("取衣单填写错误!"); return; } this.Bind(Ticket); } catch(Exception ex) { MessageBox.Show("操作失败!" + ex.Message); } }
private void btnKaiDan_Click(object sender, EventArgs e) { try { foreach(var item in GetYiFuList()) { foreach(var tempItem in GetYiFuList()) { if (tempItem != item && item.ClotheID == tempItem.ClotheID) { MessageBox.Show("衣服里面有重复的衣服单号!请检查一下!衣服单号:" + item.ClotheID); return; } } } DataOperator dop = new DataOperator(UccRuntime.SqlConfig); if (Ticket == null) Ticket = new ShouYi(); Ticket.TicketID = this.txtTicketID.Text; var temp = dop.SelectSingle(Ticket) as ShouYi; if (temp != null) { MessageBox.Show("此单号已经开过!请重新开单!"); return; } Ticket.UserID = this.txtUserID.Text; Ticket.UserName = this.txtUserName.Text; Ticket.PhoneNo = this.txtPhone.Text; Ticket.Address = this.txtAddress.Text; Ticket.PutWay = this.cbxPutWay.SelectedItem.ToString(); Ticket.Price = this.txtThisMoney.Text; Ticket.State = "未洗"; Ticket.MoneyState = this.cbxMoneyState.Text; Ticket.ShouYiDateTime = DateTime.Parse(this.datePutIn.Text); Ticket.QuYiDateTime = DateTime.Parse(this.datePutOut.Text); Ticket.ZheKou = double.Parse(this.cbxZheKou.Text); dop.Insert(Ticket); for (int i = 0; i < this.YiFuList.Count; i++) { var item = this.YiFuList[i]; item.ClotheID = item.TicketID + "-" + (i + 1); dop.Insert(item); } dop.Commit(); MessageBox.Show("操作成功!"); } catch (Exception ex) { MessageBox.Show("操作失败!" + ex.Message + ex.StackTrace); } }
public static List<PrintLine> GetTicketLines(ShouYi ticket,List<YiFu> YiFuList) { List<PrintLine> lines = new List<PrintLine>(); lines.Add(new PrintLine("美国UCC国际洗衣", 8, StringAlignment.Center)); lines.Add(new PrintLine("--------------------------------------------------", 8)); lines.Add(new PrintLine("取衣凭据", 10, StringAlignment.Center)); lines.Add(new PrintLine("取衣单号:" + ticket.TicketID, 12)); lines.Add(new PrintLine("取衣时间:" + ticket.QuYiDateTime.ToString("yyyy年MM月dd日"), 10)); lines.Add(new PrintLine("收衣时间:" + ticket.ShouYiDateTime.ToString("yyyy年MM月dd日"), 10)); lines.Add(new PrintLine("衣物件数:" + YiFuList.Count, 10)); lines.Add(new PrintLine("--------------------------------------------------", 10)); lines.Add(new PrintLine("顾客签字:_____________", 12)); lines.Add(new PrintLine("--------------------------------------------------", 10)); //lines.Add(new PrintLine("==================================================", 10)); //lines.Add(new PrintLine("编号 衣物 价格 颜色 品牌 ", 8)); //lines.Add(new PrintLine("==================================================", 8)); double sumMoney = 0; for (int i = 0; i < YiFuList.Count; i++) { sumMoney += double.Parse(YiFuList[i].Price); } double price = 0; for (int i = 0; i < YiFuList.Count; i++) { price = double.Parse(ticket.Price); lines.Add(new PrintLine("编号:" + YiFuList[i].ClotheID, 8)); lines.Add(new PrintLine("衣物:" + YiFuList[i].ClotheType + " 价格:" + YiFuList[i].Price, 8)); lines.Add(new PrintLine("颜色:" + YiFuList[i].Color + " 品牌:" + YiFuList[i].PinPai, 8)); //lines.Add(new PrintLine(YiFuList[i].ClotheID + " " + YiFuList[i].ClotheType + " " + YiFuList[i].Price + " " + YiFuList[i].Color + " " + YiFuList[i].PinPai, 8)); string xiaci = YiFuList[i].XiaCi; string[] data = xiaci.Split(','); lines.Add(new PrintLine("瑕疵:", 8)); for (int j = 0; j < data.Length; j += 3) { StringBuilder sb = new StringBuilder(); for (int k = j; k < j + 3; k++) { if (k < data.Length) if (!string.IsNullOrEmpty(data[k])) sb.Append(data[k] + " "); } lines.Add(new PrintLine(sb.ToString(), 8)); } if (!string.IsNullOrEmpty(YiFuList[i].BeiZhu)) { lines.Add(new PrintLine("备注:" + YiFuList[i].BeiZhu, 8)); } lines.Add(new PrintLine(" ", 8)); } lines.Add(new PrintLine("-------------------------------------------", 8)); if (!string.IsNullOrEmpty(ticket.BeiZhu)) { lines.Add(new PrintLine("备注:" + ticket.BeiZhu, 8)); lines.Add(new PrintLine(" ", 8)); } lines.Add(new PrintLine("交易总额:" + sumMoney + "元", 10)); lines.Add(new PrintLine("折扣:" + ticket.ZheKou + "折", 10)); lines.Add(new PrintLine("--------------------------------------------------", 8)); lines.Add(new PrintLine("实际应收:" + ticket.Price, 14)); lines.Add(new PrintLine("付款状态:" + ticket.MoneyState, 10)); lines.Add(new PrintLine(" ", 8)); if (!string.IsNullOrEmpty(ticket.UserID)) { User user = new User(); user.UserID = ticket.UserID; user = UccRuntime.Dop.SelectSingle(user) as User; lines.Add(new PrintLine("卡上余额:" + user.Money + "元", 12)); } lines.Add(new PrintLine("仿皮、皮草、地毯、单烫等不打折", 8)); lines.Add(new PrintLine("本店地址: " + UccRuntime.StoreInfo.Address, 8)); lines.Add(new PrintLine("服务热线:" + UccRuntime.StoreInfo.PhoneNo, 8)); lines.Add(new PrintLine("打印日期:" + DateTime.Now.ToString("yyyy年MM月dd日 HH:mm"), 8)); lines.Add(new PrintLine("==================================================", 8)); lines.Add(new PrintLine("凭单取衣", 8, StringAlignment.Center)); lines.Add(new PrintLine("欢迎您的光临", 8, StringAlignment.Center)); lines.Add(new PrintLine("衣服出门本店概不负责", 8, StringAlignment.Center)); lines.Add(new PrintLine("保管期超过一个月另收保管费", 8, StringAlignment.Center)); lines.Add(new PrintLine("关注本店官方微信,获取更多优惠资讯", 8, StringAlignment.Center)); return lines; }
public static List<PrintLine> GetMoneyLines(ShouYi ticket,List<YiFu> YiFuList) { List<PrintLine> lines = new List<PrintLine>(); lines.Add(new PrintLine("美国UCC国际洗衣", 8, StringAlignment.Center)); lines.Add(new PrintLine("----------------------------------------", 8)); lines.Add(new PrintLine("收款凭据", 10, StringAlignment.Center)); lines.Add(new PrintLine("收款单号:" + "M" + DateTime.Now.ToString("yyyyMMdd") + UccRuntime.Dop.Count<MoneyHistory>(), 12)); lines.Add(new PrintLine("衣物件数:" + YiFuList.Count, 10)); lines.Add(new PrintLine("--------------------------------------------------", 8)); //lines.Add(new PrintLine("========================================", 10)); //lines.Add(new PrintLine("编号 衣物 价格 颜色 品牌 ", 8)); //lines.Add(new PrintLine("========================================", 10)); double sumMoney = 0; for(int i=0;i<YiFuList.Count;i++) { sumMoney += double.Parse(YiFuList[i].Price); } double price = 0; for (int i = 0; i < YiFuList.Count; i++) { price = double.Parse(ticket.Price); //lines.Add(new PrintLine(YiFuList[i].ClotheID + " " + YiFuList[i].ClotheType + " " + YiFuList[i].Price + " " + YiFuList[i].Color + " " + YiFuList[i].PinPai, 8)); lines.Add(new PrintLine("编号:" + YiFuList[i].ClotheID, 8)); lines.Add(new PrintLine("衣物:" + YiFuList[i].ClotheType+" 价格:"+YiFuList[i].Price, 8)); lines.Add(new PrintLine("颜色:" + YiFuList[i].Color + " 品牌:" + YiFuList[i].PinPai, 8)); string xiaci = YiFuList[i].XiaCi; string[] data = xiaci.Split(','); lines.Add(new PrintLine("瑕疵:", 8)); for (int j = 0; j < data.Length; j += 3) { StringBuilder sb = new StringBuilder(); for (int k = j; k < j + 3; k++) { if (k < data.Length) if (!string.IsNullOrEmpty(data[k])) sb.Append(data[k] + " "); } lines.Add(new PrintLine(sb.ToString(), 8)); } if (!string.IsNullOrEmpty(YiFuList[i].BeiZhu)) { lines.Add(new PrintLine("备注:" + YiFuList[i].BeiZhu, 8)); } lines.Add(new PrintLine(" ", 8)); } lines.Add(new PrintLine("-------------------------------------------", 8)); if (!string.IsNullOrEmpty(ticket.BeiZhu)) { lines.Add(new PrintLine("备注:" + ticket.BeiZhu, 8)); lines.Add(new PrintLine(" ", 8)); } lines.Add(new PrintLine("交易总额:" + sumMoney + "元", 8)); lines.Add(new PrintLine("折扣:" + ticket.ZheKou + "折", 8)); lines.Add(new PrintLine("仿皮、皮草、地毯、单烫等不打折", 8)); lines.Add(new PrintLine("------------------------------------------", 8)); lines.Add(new PrintLine("实际应收:" + ticket.Price, 14)); lines.Add(new PrintLine("------------------------------------------", 8)); lines.Add(new PrintLine(" ", 8)); lines.Add(new PrintLine("顾客签字:_____________", 8)); lines.Add(new PrintLine(" ", 8)); if (!string.IsNullOrEmpty(ticket.UserID)) { User user = new User(); user.UserID = ticket.UserID; user = UccRuntime.Dop.SelectSingle(user) as User; lines.Add(new PrintLine("卡上余额:" + user.Money + "元", 12)); } lines.Add(new PrintLine("收款时间:" + DateTime.Now.ToString("yyyy年MM月dd日 HH:mm"), 8)); return lines; }