private void dataGridViewSys_CellContentClick(object sender, DataGridViewCellEventArgs e) { List <PrintSysInfo> source = (List <PrintSysInfo>) this.dataGridViewSys.DataSource; PrintSysInfo item = source[e.RowIndex]; List <PrintSysInfo> curSysInfo = new List <PrintSysInfo>(); for (int i = 0; i < curSysInfo.Count; i++) { } }
private void dataGridViewSys_CellValueChanged(object sender, DataGridViewCellEventArgs e) { /* List<PrintSysInfo> source = DataGridViewUtil.BindingListToList<PrintSysInfo>(dataGridViewSys.DataSource); //(List<PrintSysInfo>)this.dataGridViewSys.DataSource; * PrintSysInfo item = source[e.RowIndex]; * */ List <PrintSysInfo> curSysInfo = new List <PrintSysInfo>(); if (e.RowIndex >= 0 && e.ColumnIndex >= 0 && !dataGridViewSys.Rows[e.RowIndex].IsNewRow) { DataGridView view = (DataGridView)sender; List <PrintSysInfo> source = (List <PrintSysInfo>)view.DataSource; PrintSysInfo item = (PrintSysInfo)source[e.RowIndex]; if (e.ColumnIndex == Column5.Index) { flag = true; foreach (PrintSysInfo pInfo in source) { if (item.name == pInfo.name) { item.ischeck = (bool)this.dataGridViewSys[e.ColumnIndex, e.RowIndex].Value; if (item.ischeck) { curSysInfo.Add(pInfo); } } else { if (pInfo.ischeck) { curSysInfo.Add(pInfo); } } } //if (item.ischeck) //{ // curSysInfo.Add(item); //} setLblValue(curSysInfo); lastPrintSysInfo = curSysInfo; } } }
private void setLblValue(List <PrintSysInfo> oneList, List <PrintSysInfo> twoList, List <PrintSysInfo> threeList, List <PrintSysInfo> fourList, string AddText = "") { #region switch (oneList.Count) { case 0: this.lblName1.Text = ""; this.lblName2.Text = ""; this.lblName3.Text = ""; this.lblName4.Text = ""; this.lblName5.Text = ""; break; case 1: this.lblName1.Text = oneList[0].name; this.lblName2.Text = ""; this.lblName3.Text = ""; this.lblName4.Text = ""; this.lblName5.Text = ""; break; case 2: this.lblName1.Text = oneList[0].name; this.lblName2.Text = oneList[1].name; this.lblName3.Text = ""; this.lblName4.Text = ""; this.lblName5.Text = ""; break; case 3: this.lblName1.Text = oneList[0].name; this.lblName2.Text = oneList[1].name; this.lblName3.Text = oneList[2].name; this.lblName4.Text = ""; this.lblName5.Text = ""; break; case 4: this.lblName1.Text = oneList[0].name; this.lblName2.Text = oneList[1].name; this.lblName3.Text = oneList[2].name; this.lblName4.Text = oneList[3].name; this.lblName5.Text = ""; break; case 5: this.lblName1.Text = oneList[0].name; this.lblName2.Text = oneList[1].name; this.lblName3.Text = oneList[2].name; this.lblName4.Text = oneList[3].name; this.lblName5.Text = oneList[4].name; break; default: break; } #endregion #region switch (twoList.Count) { case 0: this.lblName6.Text = ""; this.lblName7.Text = ""; this.lblName8.Text = ""; this.lblName9.Text = ""; this.lblName10.Text = ""; break; case 1: this.lblName6.Text = twoList[0].name; this.lblName7.Text = ""; this.lblName8.Text = ""; this.lblName9.Text = ""; this.lblName10.Text = ""; break; case 2: this.lblName6.Text = twoList[0].name; this.lblName7.Text = twoList[1].name; this.lblName8.Text = ""; this.lblName9.Text = ""; this.lblName10.Text = ""; break; case 3: this.lblName6.Text = twoList[0].name; this.lblName7.Text = twoList[1].name; this.lblName8.Text = twoList[2].name; this.lblName9.Text = ""; this.lblName10.Text = ""; break; case 4: this.lblName6.Text = twoList[0].name; this.lblName7.Text = twoList[1].name; this.lblName8.Text = twoList[2].name; this.lblName9.Text = twoList[3].name; this.lblName10.Text = ""; break; case 5: this.lblName6.Text = twoList[0].name; this.lblName7.Text = twoList[1].name; this.lblName8.Text = twoList[2].name; this.lblName9.Text = twoList[3].name; this.lblName10.Text = twoList[4].name; break; default: break; } #endregion #region switch (threeList.Count) { case 0: this.lblName11.Text = ""; this.lblName12.Text = ""; this.lblName13.Text = ""; this.lblName14.Text = ""; this.lblName15.Text = ""; this.lblName16.Text = ""; this.lblName17.Text = ""; this.lblName18.Text = ""; break; case 1: this.lblName11.Text = threeList[0].name; this.lblName12.Text = ""; this.lblName13.Text = ""; this.lblName14.Text = ""; this.lblName15.Text = ""; this.lblName16.Text = ""; this.lblName17.Text = ""; this.lblName18.Text = ""; break; case 2: this.lblName11.Text = threeList[0].name; this.lblName12.Text = threeList[1].name; this.lblName13.Text = ""; this.lblName14.Text = ""; this.lblName15.Text = ""; this.lblName16.Text = ""; this.lblName17.Text = ""; this.lblName18.Text = ""; break; case 3: this.lblName11.Text = threeList[0].name; this.lblName12.Text = threeList[1].name; this.lblName13.Text = threeList[2].name; this.lblName14.Text = ""; this.lblName15.Text = ""; this.lblName16.Text = ""; this.lblName17.Text = ""; this.lblName18.Text = ""; break; case 4: this.lblName11.Text = threeList[0].name; this.lblName12.Text = threeList[1].name; this.lblName13.Text = threeList[2].name; this.lblName14.Text = threeList[3].name; this.lblName15.Text = ""; this.lblName16.Text = ""; this.lblName17.Text = ""; this.lblName18.Text = ""; break; case 5: this.lblName11.Text = threeList[0].name; this.lblName12.Text = threeList[1].name; this.lblName13.Text = threeList[2].name; this.lblName14.Text = threeList[3].name; this.lblName15.Text = threeList[4].name; this.lblName16.Text = ""; this.lblName17.Text = ""; this.lblName18.Text = ""; break; case 6: this.lblName11.Text = threeList[0].name; this.lblName12.Text = threeList[1].name; this.lblName13.Text = threeList[2].name; this.lblName14.Text = threeList[3].name; this.lblName15.Text = threeList[4].name; this.lblName16.Text = threeList[5].name; this.lblName17.Text = ""; this.lblName18.Text = ""; break; case 7: this.lblName11.Text = threeList[0].name; this.lblName12.Text = threeList[1].name; this.lblName13.Text = threeList[2].name; this.lblName14.Text = threeList[3].name; this.lblName15.Text = threeList[4].name; this.lblName16.Text = threeList[5].name; this.lblName17.Text = threeList[6].name; this.lblName18.Text = ""; break; case 8: this.lblName11.Text = threeList[0].name; this.lblName12.Text = threeList[1].name; this.lblName13.Text = threeList[2].name; this.lblName14.Text = threeList[3].name; this.lblName15.Text = threeList[4].name; this.lblName16.Text = threeList[5].name; this.lblName17.Text = threeList[6].name; this.lblName18.Text = threeList[7].name; break; default: break; } #endregion #region if (fourList.Count > 0) { PrintSysInfo sumL = fourList.Find(t => t.name == "数量"); if (sumL != null) { lbl1.Text = sumL.name; } else { lbl1.Text = ""; } PrintSysInfo DisL = fourList.Find(t => t.name == "折扣优惠"); if (DisL != null) { lbl2.Text = DisL.name; } else { lbl2.Text = ""; } PrintSysInfo GetL = fourList.Find(t => t.name == "应收"); if (GetL != null) { lbl3.Text = GetL.name; } else { lbl3.Text = ""; } PrintSysInfo GetNameL = fourList.Find(t => t.name == "姓名"); if (GetNameL != null) { lbl4.Text = GetNameL.name; } else { lbl4.Text = ""; } PrintSysInfo GetZeroL = fourList.Find(t => t.name == "找零"); if (GetZeroL != null) { lbl5.Text = GetZeroL.name; } else { lbl5.Text = ""; } PrintSysInfo ShopCodeL = fourList.Find(t => t.name == "商城二维码"); if (ShopCodeL != null) { isAddQRCode = true; } else { isAddQRCode = false; } PrintSysInfo addRemarkL = fourList.Find(t => t.name == "结尾附加文字"); if (addRemarkL != null) { rtfRichTextBox_Remarks.Enabled = true; if (AddText != "") { rtfRichTextBox_Remarks.Text = AddText; } } else { rtfRichTextBox_Remarks.Text = ""; rtfRichTextBox_Remarks.Enabled = false; } PrintSysInfo ShopTitleL = fourList.Find(t => t.name == "店铺"); if (ShopTitleL != null) { lblCurDataName.Text = "店铺名称"; } else { lblCurDataName.Text = ""; } } #endregion }
private void dataGridViewSys_CellValueChanged(object sender, DataGridViewCellEventArgs e) { List <PrintSysInfo> curSysInfo = new List <PrintSysInfo>(); List <PrintSysInfo> firstList1 = new List <PrintSysInfo>(); List <PrintSysInfo> secondList2 = new List <PrintSysInfo>(); List <PrintSysInfo> thirdList3 = new List <PrintSysInfo>(); List <PrintSysInfo> fourthList4 = new List <PrintSysInfo>(); List <PrintSysInfo> fiveList5 = new List <PrintSysInfo>(); List <PrintSysInfo> sixList6 = new List <PrintSysInfo>(); if (e.RowIndex >= 0 && e.ColumnIndex >= 0 && !dataGridViewSys.Rows[e.RowIndex].IsNewRow) { DataGridView view = (DataGridView)sender; List <PrintSysInfo> source = (List <PrintSysInfo>)view.DataSource; PrintSysInfo item = (PrintSysInfo)source[e.RowIndex]; if (e.ColumnIndex == Column5.Index) { flag = true; foreach (PrintSysInfo pInfo in source) { if (item.name == pInfo.name && item.type == pInfo.type) { item.ischeck = (bool)this.dataGridViewSys[e.ColumnIndex, e.RowIndex].Value; if (item.ischeck) { if (pInfo.name == "日结时间" || pInfo.name == "日结日期" || pInfo.name == "店铺名称") { firstList1.Add(pInfo); } else if (pInfo.name == "期初库存" || pInfo.name == "采购进货" || pInfo.name == "采购退货" || pInfo.name == "调拨入库" || pInfo.name == "调拨" || pInfo.name == "报损出库" || pInfo.name == "盘盈数" || pInfo.name == "盘亏数" || pInfo.name == "批发发货" || pInfo.name == "批发退货" || pInfo.name == "当日销售" || pInfo.name == "顾客退货" || pInfo.name == "差异调整" || pInfo.name == "期末库存" ) { secondList2.Add(pInfo); } else if ((pInfo.name == "现金" && pInfo.type == 0) || (pInfo.name == "银联卡" && pInfo.type == 0) || (pInfo.name == "微信" && pInfo.type == 0) || (pInfo.name == "支付宝" && pInfo.type == 0) || (pInfo.name == "VIP卡余额" && pInfo.type == 0) || pInfo.name == "VIP卡积分返现" || pInfo.name == "优惠券金额") { thirdList3.Add(pInfo); } else if ((pInfo.name == "现金" && pInfo.type == 1) || (pInfo.name == "银联卡" && pInfo.type == 1) || (pInfo.name == "微信" && pInfo.type == 1) || (pInfo.name == "支付宝" && pInfo.type == 1) || (pInfo.name == "其他" && pInfo.type == 1)) { pInfo.type = 1; fourthList4.Add(pInfo); } else if (pInfo.name == "零售单数" || pInfo.name == "营收金额" || pInfo.name == "当日现金结余") { fiveList5.Add(pInfo); } else if (pInfo.name == "营业员签名" || pInfo.name == "财务签名") { sixList6.Add(pInfo); } //curSysInfo.Add(pInfo); } } else { if (pInfo.ischeck) { if (pInfo.name == "日结时间" || pInfo.name == "日结日期" || pInfo.name == "店铺名称") { firstList1.Add(pInfo); } else if (pInfo.name == "期初库存" || pInfo.name == "采购进货" || pInfo.name == "采购退货" || pInfo.name == "调拨入库" || pInfo.name == "调拨" || pInfo.name == "报损出库" || pInfo.name == "盘盈数" || pInfo.name == "盘亏数" || pInfo.name == "批发发货" || pInfo.name == "批发退货" || pInfo.name == "当日销售" || pInfo.name == "顾客退货" || pInfo.name == "差异调整" || pInfo.name == "期末库存" ) { secondList2.Add(pInfo); } else if ((pInfo.name == "现金" && pInfo.type == 0) || (pInfo.name == "银联卡" && pInfo.type == 0) || (pInfo.name == "微信" && pInfo.type == 0) || (pInfo.name == "支付宝" && pInfo.type == 0) || (pInfo.name == "VIP卡余额" && pInfo.type == 0) || pInfo.name == "VIP卡积分返现" || pInfo.name == "优惠券金额") { thirdList3.Add(pInfo); } else if ((pInfo.name == "现金" && pInfo.type == 1) || (pInfo.name == "银联卡" && pInfo.type == 1) || (pInfo.name == "微信" && pInfo.type == 1) || (pInfo.name == "支付宝" && pInfo.type == 1) || (pInfo.name == "其他" && pInfo.type == 1)) { pInfo.type = 1; fourthList4.Add(pInfo); } else if (pInfo.name == "零售单数" || pInfo.name == "营收金额" || pInfo.name == "当日现金结余") { fiveList5.Add(pInfo); } else if (pInfo.name == "营业员签名" || pInfo.name == "财务签名") { sixList6.Add(pInfo); } } } } //if (item.ischeck) //{ // curSysInfo.Add(item); //} setLblValue(firstList1, secondList2, thirdList3, fourthList4, fiveList5, sixList6); foreach (PrintSysInfo oneItem in firstList1) { curSysInfo.Add(oneItem); } foreach (PrintSysInfo twoItem in secondList2) { curSysInfo.Add(twoItem); } foreach (PrintSysInfo threeItem in thirdList3) { curSysInfo.Add(threeItem); } foreach (PrintSysInfo fourItem in fourthList4) { curSysInfo.Add(fourItem); } foreach (PrintSysInfo fiveItem in fiveList5) { curSysInfo.Add(fiveItem); } foreach (PrintSysInfo sixItem in sixList6) { curSysInfo.Add(sixItem); } lastPrintSysInfo = curSysInfo; } } }
private void dataGridViewSys_CellValueChanged(object sender, DataGridViewCellEventArgs e) { /* List<PrintSysInfo> source = DataGridViewUtil.BindingListToList<PrintSysInfo>(dataGridViewSys.DataSource); //(List<PrintSysInfo>)this.dataGridViewSys.DataSource; * PrintSysInfo item = source[e.RowIndex]; * */ if (e.RowIndex >= 0 && e.ColumnIndex >= 0) { curSysInfo = new List <PrintSysInfo>(); if (!dataGridViewSys.Rows[e.RowIndex].IsNewRow) { DataGridView view = (DataGridView)sender; List <PrintSysInfo> source = (List <PrintSysInfo>)view.DataSource; PrintSysInfo item = (PrintSysInfo)source[e.RowIndex]; List <PrintSysInfo> curFirstInfo = new List <PrintSysInfo>(); List <PrintSysInfo> curSecondInfo = new List <PrintSysInfo>(); List <PrintSysInfo> curThirdInfo = new List <PrintSysInfo>(); List <PrintSysInfo> curFourthInfo = new List <PrintSysInfo>(); if (e.ColumnIndex == Column5.Index) { flag = true; foreach (PrintSysInfo pInfo in source) { if (pInfo.ischeck) { if (pInfo.name == "单号" || pInfo.name == "日期" || pInfo.name == "电话" || pInfo.name == "地址" || pInfo.name == "顾问") { curFirstInfo.Add(pInfo); } else if (pInfo.name == "卡号" || pInfo.name == "本次积分" || pInfo.name == "当前积分" || pInfo.name == "累计积分" || pInfo.name == "余额") { curSecondInfo.Add(pInfo); } else if (pInfo.name == "银联卡" || pInfo.name == "现金" || pInfo.name == "VIP卡" || pInfo.name == "支付宝" || pInfo.name == "微信" || pInfo.name == "积分兑现" || pInfo.name == "优惠券" || pInfo.name == "其他") { curThirdInfo.Add(pInfo); } else if (pInfo.name == "数量" || pInfo.name == "折扣优惠" || pInfo.name == "应收" || pInfo.name == "姓名" || pInfo.name == "找零" || pInfo.name == "结尾附加文字" || pInfo.name == "商城二维码" || pInfo.name == "店铺") { curFourthInfo.Add(pInfo); } } // } } //if (item.ischeck) //{ // curSysInfo.Add(item); //} setLblValue(curFirstInfo, curSecondInfo, curThirdInfo, curFourthInfo); foreach (PrintSysInfo oneItem in curFirstInfo) { curSysInfo.Add(oneItem); } foreach (PrintSysInfo twoItem in curSecondInfo) { curSysInfo.Add(twoItem); } foreach (PrintSysInfo threeItem in curThirdInfo) { curSysInfo.Add(threeItem); } foreach (PrintSysInfo fourItem in curFourthInfo) { curSysInfo.Add(fourItem); } lastPrintSysInfo = curSysInfo; } } } }