/// <summary> /// 面板的处理点击事件 /// </summary> /// <param name="ckPanel">当前对象</param> /// <param name="btnText">button显示的text文本</param> private void ckPanel1_SetInfo(CKPanel ckPanel, string btnText, string payId, decimal faceValue) { int j; if (Decimal.Round(Convert.ToDecimal(this.txtPay.Text), 2) - Info.totalPrice < 0) { for (j = 0; j < getPayment.ReturnRecordCount; j++) { if (getPayment.ReturnDispName(j).Equals(btnText)) { if (getPayment.ReturnPayName(payId).Equals("现金")) { btnmoneyclick = true; index = j; btnMoney += decimal.Round(Info.inputNumber, dataAccur); btnInputNumber += decimal.Round(Info.inputNumber, dataAccur); Info.inputNumber = 0; this.mainForm.Number.TextBoxText = ""; this.mainForm.OperPara.WriteIniInfo("inputNumber", "0"); dataAccur = Convert.ToInt32(getPayment.ReturnDataAccur(j)); if (0 == dataAccur) { dataAccur = 1; } SetPrice(); CheckStatus(btnText); this.mainForm.Number.ClearNum(); break; } string pay_id = payId; decimal Face_Value = faceValue; btnInputNumber += Face_Value; this.txtPay.Text = btnInputNumber.ToString(); decimal amount = Face_Value; char transferStatus = getPayment.ReturnTransferStatus(j); SetPrice(); CheckStatus(btnText); this.InsertSaleTemp02(Info.shop_id, Info.sale_id, sale_sno, pay_id, amount, transferStatus, dateTime, Face_Value); sale_sno += 1; } } } else { MessageBox.Show("抱歉!已付金额已足够!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// 对CkPanel的初始化 /// </summary> /// <param name="ckPanel">this</param> /// <param name="isLoad">bool变量</param> private void ckPanel1_GetInfo(CKPanel ckPanel, bool isLoad) { //设置行数和列数 int recordCount = getPayment.ReturnRecordCount; this.ckPanel1.ColumnRow = new Size(4, 4); //设置按钮是数量 this.ckPanel1.TotalBtn = recordCount; string[] showString = new string[recordCount]; Color[] btnColor = new Color[recordCount]; Font[] txtFont = new Font[recordCount]; Color[] fontColor = new Color[recordCount]; string[] pay_id = new string[recordCount]; decimal[] faceValue = new decimal[recordCount]; //分配内存空间 checkOutMoney = new status[recordCount]; for (int i = 0; i < recordCount; i++) { showString[i] = getPayment.ReturnDispName(i); checkOutMoney[i].name = showString[i]; checkOutMoney[i].count = 0; btnColor[i] = getPayment.ReturnBtnColor(i); txtFont[i] = getPayment.ReturnFont(i); fontColor[i] = getPayment.ReturnFondColor(i); pay_id[i] = getPayment.ReturnPay_Id(i); faceValue[i] = getPayment.ReturnFace_Value(i); } //设置按钮上显示的文字 this.ckPanel1.StringArray = showString; //设置按钮上的背景颜色 this.ckPanel1.AllBtnColor = btnColor; //设置按钮上的字体 this.ckPanel1.AllBtnFont = txtFont; //设置字体颜色 this.ckPanel1.AllBtnFontColor = fontColor; //设置付款类型 this.ckPanel1.PayId = pay_id; //面值 this.ckPanel1.FaceValue = faceValue; }