海马汽车经销商管理系统技术解析(三)应收管理
来源:互联网 发布:iphone2333软件 编辑:程序博客网 时间:2024/04/28 20:00
海马汽车经销商管理系统技术解析(三)应收管理
应收管理这个模块可以查看所有欠款的客户和每个客户的欠款明细信息,还可以新建欠账单和删除欠账单。可以通过客户姓名、发生日期等条件对欠账单进行筛选查询。还可以对欠账单进行收款操作。还有上页、下页等功能。
主界面如图(图1)所示:
(图1)
查询界面如图(图2)所示:
可以根据不同的条件查询账单。
(图2)
建账界面如图(图3)所示:
(图3)
选择收款明细界面如图(图4)所示:
(图4)
收款界面如图(图5)所示:
(图5)
从界面上可以看到我们这里用到的控件有
控件名称
说明
(ToolStrip)
控件可以在工具箱直接拖动至窗体,拖至窗体后右击属性可以修改控件的样式和各种属性,还可以编辑事件。
表格(DataGridView)
按钮(toolStripButton) /(Button)
复选框(CheckBox)
下拉框(ComBoBox)
文本框(TextBox)
单选框(RadioButton)
显示功能实现:第一步:数据库
1、表和关系
(图6) 列名 数据类型 主键/外键 说明
表1:车主信息表(BM_CarOwnerNewsList)
用于存放车主录入的信息
CarOwnerNewsID
int
主键
车主信息ID
CarOwnerCode
nchar (20)
车主代码
CarOwnerName
nchar (20)
车主姓名
AttributeMinuteID_ClientTypeOne
int
外键
属性明细ID_客户类型一
AttributeMinuteID_ClientTypeTwo
int
外键
属性明细ID_客户类型二
AttributeMinuteID_Sex
int
外键
属性明细ID_性别
Site
nchar (100)
地址
MobilePhone
nchar (20)
移动电话
HousePhone
nchar (20)
住宅电话
OfficePhone
nchar (20)
办公电话
AddressPostcode
nchar (20)
住址邮编
TheGenusCountiesAndCities
nchar (50)
所属县市
WorkUnit
nchar (50)
工作单位
Job
nchar (50)
职务
AttributeMinuteID_MaritalStatus
int
外键
属性明细ID_婚姻状况
IDCard
nchar (30)
身份证号码
Birthday
datetime
生日
Hobby
nchar (100)
爱好
ChangeSite
nchar (100)
变更地址
Postcode
nchar (20)
邮编
Nationality
nchar (50)
国籍
nchar (50)
FacilitateTheReturnTime
datetime
方便回访时间
CarOwnerPicture
nchar (3000)
车主照片
Remarks
nchar (50)
备注
IfEffective
bit
有效否
表2:PW_欠款表(PW_DebtList)用于存放欠款的信息
列名
数据类型
主键/外键
说明
DebtID
int
主键
欠款ID
CarOwnerNewsID
int
外键
车主信息表,车主信息ID
AllHappenMoney
decimal (18, 2)
总发生金额
AllGatheringMoney
decimal (18, 2)
总收款金额
Balance
decimal (18, 2)
余额
NewestRenovateDate
datetime
最新更新日期
BuildAccountDate
datetime
建帐日期
表3:PW_欠款结算表(PW_DebtSetMealList)主用于存放欠款明细的信息
列名
数据类型
主键/外键
说明
DebtSetMealID
int
主键
欠款结算ID
DebtID
int
外键
欠款表,欠款ID
HappenDate
datetime
发生日期
OperateType
Int
操作类型
AtributeMinuteID_SourceClassify
nchar (20)
外键
属性明细表,属性明细ID_来源分类
BusinessOddlNumbers
nchar (20)
业务单号
HappenMoney
decimal (18, 2)
发生金额
FactReceiveMoney
decimal (18, 2)
实收金额
AttributeMinuteID_GatheringWay
int
外键
属性明细表,属性明细ID_收款方式
StaffID_GatheringPerson
Int
外键
员工表,员工ID_收款人
Remarks
nchar (100)
备注
表4:PW_员工档案表 (BM_StaffRecordList)主用于存放员工录入档案的信息
列名
数据类型
主键/外键
说明
StaffID
int
主键
员工ID
StaffBasicDataID
int
外键
员工基本资料ID
StaffNumber
nchar (20)
员工编号
SuperiorCode
nchar (20)
上级代码
StaffName
nchar (20)
员工姓名
TheGenusShop
nchar (50)
所属店
SectionID
int
外键
部门ID
TeamID
int
外键
班组ID
OtherLinkWay
nchar (50)
其他联系方式
MonthRestDay
datetime
月休息日
StartWorkTime
datetime
从业时间
BasicWages
decimal (18, 2)
基础工资
OtherWages
decimal (18, 2)
其他工资
IfApprentice
bit
学徒否
IfServiceman
bit
维修技工否
IfCanGet
bit
可领料否
IfInspectorGeneral
bit
总检人否
IfTestRun
bit
试车人否
IfSalesman
bit
业务员否
IfLeaveOffice
bit
离职否
StaffPicture
nchar (1000)
员工照片
第二步:技术解析1、分页(上页、下页)功能
第一步:数据库的存储过程
IF(@TYPE ='FRM_YingShouGuanLi_Load_Select_QianKuanXinXi')BEGINSELECT PW_DebtList.DebtID, PW_DebtList.AllHappenMoney, PW_DebtList.AllGatheringMoney, PW_DebtList.Balance, PW_DebtList.NewestRenovateDate, PW_DebtList.BuildAccountDate, PW_DebtList.CarOwnerNewsID, BM_CarOwnerNewsList.CarOwnerCode, BM_CarOwnerNewsList.CarOwnerNameFROM PW_DebtList INNER JOIN BM_CarOwnerNewsList ON PW_DebtList.CarOwnerNewsID = BM_CarOwnerNewsList.CarOwnerNewsIDEND第二步:逻辑层(BLL)代码
DALPublic.DALMethod myDALMethod = new DALPublic.DALMethod(); [OperationContract] public DataSet FRM_YingShouGuanLi_Load_Select_QianKuanXinXi() { SqlParameter[] mySqlParameters ={ new SqlParameter("@TYPE",SqlDbType.Char), }; mySqlParameters[0].Value = "FRM_YingShouGuanLi_Load_Select_QianKuanXinXi"; DataTable dt = myDALMethod.QueryDataTable("财务管理_FRM_YingShouGuanLi", mySqlParameters); DataSet ds = new DataSet(); ds.Tables.Add(dt); return ds; }
第三步:界面层(UIL)代码,写进窗体的Load事件
dtFinanceGatheringBill = myFRM_YingShouGuanLiClient.FRM_YingShouGuanLi_Load_Select_QianKuanXinXi().Tables[0]; intCount = dtFinanceGatheringBill.Rows.Count;//获取表的行数 intYeShu = dtFinanceGatheringBill.Rows.Count / 10;//获取页数 decYuShu = dtFinanceGatheringBill.Rows.Count % 10;//获取尾页的行数 if (decYuShu > 0) { intYeShu++;//最大页数 if (intIndex == intYeShu) { Row = decYuShu;//尾页行数 } } if (intCount > 0) { dtRow = dtFinanceGatheringBill.Copy();//复制表 dtRow.Clear();//清空表内容 for (int i = (intIndex - 1) * 10; i < Row; i++) { DataRow row = dtRow.NewRow();//创建空白行 row.ItemArray = dtFinanceGatheringBill.Rows[i].ItemArray;//复制行 dtRow.Rows.Add(row);//把行添加进表 } } dgvFinanceGatheringBill.DataSource = dtRow;
上页按钮功能代码:
/// <summary>/// 上一页按钮功能代码/// </summary>/// <param name="sender">触发者</param>/// <param name="e">触发事件</param> private void btnBefore_Click(object sender, EventArgs e) { if (intIndex > 1)//不是首页 { intIndex--;//页码减1 Row = intIndex * 10; dtRow = dtFinanceGatheringBill.Copy();//复制行 dtRow.Clear();//清空表内容 for (int i = (intIndex - 1) * 10; i < Row; i++) { DataRow row = dtRow.NewRow();//创建空白行 row.ItemArray = dtFinanceGatheringBill.Rows[i].ItemArray;//复制行 dtRow.Rows.Add(row);//把行添加进表 } dgvFinanceGatheringBill.DataSource = dtRow; } else { MessageBox.Show("已经是首页了!"); } }
下一页按钮功能代码:
/// <summary>/// 下一页功能代码/// </summary>/// <param name="sender">触发者</param>/// <param name="e">触发事件</param> private void btnNext_Click(object sender, EventArgs e) { if (intIndex < intYeShu) { intIndex++;//页码加1 if (intIndex == intYeShu)//页码等于最大页数 { Row = intCount; } else { Row = intIndex * 10; } dtRow = dtFinanceGatheringBill.Copy();//复制行 dtRow.Clear();//清空表内容 for (int i = (intIndex - 1) * 10; i < Row; i++) { DataRow row = dtRow.NewRow();//创建空白行 row.ItemArray = dtFinanceGatheringBill.Rows[i].ItemArray;//复制行 dtRow.Rows.Add(row);//把行添加进表 } dgvFinanceGatheringBill.DataSource = dtRow; } else { MessageBox.Show("已经是尾页了!"); } }
2、设置文本框(TextBox)只能输入数字(小数、正数)
第一步:界面层(UIL)代码,写进文本框的KeyPress事件
private void txtSpareMoney_KeyPress(object sender, KeyPressEventArgs e) { if ((e.KeyChar < 48 || e.KeyChar > 57) && (e.KeyChar != 8 && e.KeyChar != (char)('.'))) { MessageBox.Show("请输入正确内容!", "提示!",//弹出消息对话框 MessageBoxButtons.OK, MessageBoxIcon.Information); e.Handled = true; } //只能输入一个小数点 if (e.KeyChar == (char)('.') && ((TextBox)sender).Text.IndexOf('.') != -1) { MessageBox.Show("请输入正确内容!", "提示!",//弹出消息对话框 MessageBoxButtons.OK, MessageBoxIcon.Information); e.Handled = true; } //第一位不能是小数点 if (e.KeyChar == (char)('.') && txtSpareMoney + ".Text+ " == "") { MessageBox.Show("请输入正确内容!", "提示!",//弹出消息对话框 MessageBoxButtons.OK, MessageBoxIcon.Information); e.Handled = true; } }
3、根据下拉框自动绑定文本框
第一步:数据库存储过程
IF(@TYPE ='cboClientCode_Select_ChaXunKeHuDaiMa') BEGINSELECT CarOwnerNewsID,RTRIM (LTRIM (CarOwnerCode)) AS CarOwnerCodeFROM BM_CarOwnerNewsList END IF(@TYPE='txtClientName_Select_IDChaXunKeHuName') BEGINSELECT RTRIM(LTRIM(BM_CarOwnerNewsList.CarOwnerName)) AS CarOwnerNameFROM BM_CarOwnerNewsList WHERE BM_CarOwnerNewsList.CarOwnerNewsID =@CarOwnerNewsID END
第二步:逻辑层(BLL)代码
DALPublic.DALMethod myDALMethod = new DALPublic.DALMethod(); [OperationContract] public DataSet cboClientCode_Select_ChaXunKeHuDaiMa() { SqlParameter[] mySqlParameters ={ new SqlParameter("@TYPE",SqlDbType.Char), }; mySqlParameters[0].Value = "cboClientCode_Select_ChaXunKeHuDaiMa"; DataTable dt = myDALMethod.QueryDataTable("财务管理_FRM_YingShouGuanLi_JianZhang", mySqlParameters); DataSet ds = new DataSet(); ds.Tables.Add(dt); return ds; } [OperationContract] public DataSet txtClientName_Select_IDChaXunKeHuName(int intCarOwnerNewsID) { SqlParameter[] mySqlParameters ={ new SqlParameter("@TYPE",SqlDbType.Char), new SqlParameter("@CarOwnerNewsID",SqlDbType.Int), }; mySqlParameters[0].Value = "txtClientName_Select_IDChaXunKeHuName"; mySqlParameters[1].Value = intCarOwnerNewsID; DataTable dt = myDALMethod.QueryDataTable("财务管理_FRM_YingShouGuanLi_JianZhang", mySqlParameters); DataSet ds = new DataSet(); ds.Tables.Add(dt); return ds; }
第三步:界面层(UIL)代码
先在Load事件绑定下拉框数据:
DataTable dtClientCode = myFRM_YingShouGuanLi_JianZhangClient.cboClientCode_Select_ChaXunKeHuDaiMa().Tables[0]; PublicStaticMothd.SetZhiXiaLaKuang(cboClientCode, dtClientCode, "CarOwnerNewsID", "CarOwnerCode"); Switch = true;然后在下拉框 SelectedValueChanged事件写代码:
private void cboClientCode_SelectedValueChanged(object sender, EventArgs e) { if(Switch ==true) { int CarOwnerNewsID = Convert.ToInt32(cboClientCode.SelectedValue); DataTable dtCarOwnerName = myFRM_YingShouGuanLi_JianZhangClient.txtClientName_Select_IDChaXunKeHuName(CarOwnerNewsID).Tables[0]; txtClientName.Text = dtCarOwnerName.Rows[0]["CarOwnerName"].ToString().Trim(); } }
4、初始建账功能
如果建账的客户已经有欠账明细记录则修改欠账总额和最新更新日期,然后新建欠账明细信息;如果建账的客户是首次欠账则新增欠账信息和欠账明细信息。
第一步:数据库存储过程
IF(@TYPE='btnConfirm_Click_Update_XiuGaiBuFenQianKuanXinXi') BEGIN UPDATE PW_DebtList SET AllHappenMoney=@AllHappenMoney,Balance=@Balance, NewestRenovateDate=@NewestRenovateDate WHERE PW_DebtList.DebtID =@DebtID ENDIF(@TYPE ='btnConfirm_Click_Insert_XinZengQianKuanXinXi')BEGININSERT PW_DebtList(AllHappenMoney,AllGatheringMoney,Balance, NewestRenovateDate,BuildAccountDate,CarOwnerNewsID)VALUES (@AllHappenMoney,@AllGatheringMoney,@Balance, @NewestRenovateDate,@BuildAccountDate,@CarOwnerNewsID) SELECT @@IDENTITY ENDIF(@TYPE ='btnConfirm_Click_Insert_XinZengQianKuanMingXiXinXi')BEGININSERT PW_DebtSetMealList(DebtID, HappenDate, OperateType, AtributeMinuteID_SourceClassify, BusinessOddlNumbers, HappenMoney,FactReceiveMoney, AttributeMinuteID_GatheringWay,StaffID_GatheringPerson) VALUES (@DebtID,@HappenDate,@OperateType, @AtributeMinuteID_SourceClassify,@BusinessOddlNumbers,@HappenMoney,@FactReceiveMoney, @AttributeMinuteID_GatheringWay,@StaffID_GatheringPerson)END
第二步:逻辑层(BLL)代码
[OperationContract] public int btnConfirm_Click_Update_XiuGaiBuFenQianKuanXinXi(decimal decAllHappenMoney,decimal decBalance, DateTime dtmNewestRenovateDate, int intDebtID) { SqlParameter[] mySqlParameters ={ new SqlParameter("@TYPE",SqlDbType.Char), new SqlParameter ("@AllHappenMoney",SqlDbType.Decimal), new SqlParameter ("@Balance",SqlDbType .Decimal), new SqlParameter ("@NewestRenovateDate",SqlDbType.DateTime), new SqlParameter ("@DebtID",SqlDbType.Int), }; mySqlParameters[0].Value = "btnConfirm_Click_Update_XiuGaiBuFenQianKuanXinXi"; mySqlParameters[1].Value = decAllHappenMoney; mySqlParameters[2].Value = decBalance; mySqlParameters[3].Value = dtmNewestRenovateDate; mySqlParameters[4].Value = intDebtID; return myDALMethod.UpdateData("财务管理_FRM_YingShouGuanLi_JianZhang", mySqlParameters); } [OperationContract] public int btnConfirm_Click_Insert_XinZengQianKuanXinXi(decimal decAllHappenMoney, decimal decAllGatheringMoney, decimal decBalance, DateTime dtmNewestRenovateDate, DateTime dtmBuildAccountDate, int intCarOwnerNewsID) { SqlParameter[] mySqlParameters ={ new SqlParameter("@TYPE",SqlDbType.Char), new SqlParameter("@AllHappenMoney",SqlDbType.Decimal), new SqlParameter("@AllGatheringMoney",SqlDbType.Decimal), new SqlParameter("@Balance",SqlDbType.Decimal), new SqlParameter("@NewestRenovateDate",SqlDbType.DateTime), new SqlParameter("@BuildAccountDate",SqlDbType.DateTime), new SqlParameter("@CarOwnerNewsID",SqlDbType.Int), }; mySqlParameters[0].Value = "btnConfirm_Click_Insert_XinZengQianKuanXinXi"; mySqlParameters[1].Value = decAllHappenMoney; mySqlParameters[2].Value = decAllGatheringMoney; mySqlParameters[3].Value = decBalance; mySqlParameters[4].Value = dtmNewestRenovateDate; mySqlParameters[5].Value = dtmBuildAccountDate; mySqlParameters[6].Value = intCarOwnerNewsID; DataTable dt= myDALMethod.QueryDataTable("财务管理_FRM_YingShouGuanLi_JianZhang", mySqlParameters); return Convert.ToInt32 ( dt.Rows[0][0]); } [OperationContract] public int btnConfirm_Click_Insert_XinZengQianKuanMingXiXinXi(int intDebtID, DateTime dtmHappenDate, string strOperateType, int intAtributeMinuteID_SourceClassify, string strBusinessOddlNumbers, decimal decHappenMoney, decimal decFactReceiveMoney, int intAttributeMinuteID_GatheringWay, int intStaffID_GatheringPerson) { SqlParameter[] mySqlParameters ={ new SqlParameter("@TYPE",SqlDbType.Char), new SqlParameter("@DebtID",SqlDbType.Int), new SqlParameter("@HappenDate",SqlDbType.DateTime), new SqlParameter("@OperateType",SqlDbType.Char), new SqlParameter("@AtributeMinuteID_SourceClassify",SqlDbType.Int), new SqlParameter("@BusinessOddlNumbers",SqlDbType.Char), new SqlParameter("@HappenMoney",SqlDbType.Decimal), new SqlParameter ("@FactReceiveMoney",SqlDbType .Decimal), new SqlParameter ("@AttributeMinuteID_GatheringWay",SqlDbType .Int), new SqlParameter ("@StaffID_GatheringPerson",SqlDbType .Int), }; mySqlParameters[0].Value = "btnConfirm_Click_Insert_XinZengQianKuanMingXiXinXi"; mySqlParameters[1].Value = intDebtID; mySqlParameters[2].Value = dtmHappenDate; mySqlParameters[3].Value = strOperateType; mySqlParameters[4].Value = intAtributeMinuteID_SourceClassify; mySqlParameters[5].Value = strBusinessOddlNumbers; mySqlParameters[6].Value = decHappenMoney; mySqlParameters[7].Value = decFactReceiveMoney; mySqlParameters[8].Value = intAttributeMinuteID_GatheringWay; mySqlParameters[9].Value = intStaffID_GatheringPerson; return myDALMethod.UpdateData("财务管理_FRM_YingShouGuanLi_JianZhang", mySqlParameters); }
第三步:界面层(UIL)代码,写进Button单击事件
private void btnConfirm_Click(object sender, EventArgs e) { int DebtID = 0; int i = 0; int OldDebtID = 0; int OldDebtSetMealID = 0; int NewDebtID = 0; int NewDebtSetMealID = 0; decimal decAllHappenMoney = 0; decimal decBalance = 0; decimal Balance = 0; DataTable dtAllClientCode = myFRM_YingShouGuanLi_JianZhangClient.btnConfirm_Click_Select_ChaXunAllKeHu().Tables[0]; for (int h = 0; h < dtAllClientCode.Rows.Count; h++)//循坏查询欠款表中的所有客户信息 { if (Convert.ToInt32(cboClientCode.SelectedValue) == Convert.ToInt32(dtAllClientCode.Rows[h]["CarOwnerNewsID"]))//下拉框选择的客户ID等于表中的某一客户ID { DebtID = (int)dtAllClientCode.Rows[h]["DebtID"];//欠款ID等于表中当前客户的欠款ID i++; decAllMoney = Convert.ToDecimal(dtAllClientCode.Rows[h]["AllHappenMoney"].ToString());//总金额等于表中当前客户的总发生金额 Balance = Convert.ToDecimal(dtAllClientCode.Rows[h]["Balance"].ToString());//原余额等于表中当前客户的余额 } } decAllHappenMoney = decAllMoney + Convert.ToDecimal(txtSpareMoney.Text);//总发生金额等于总金额+文本框的值 decBalance = Balance + Convert.ToDecimal(txtSpareMoney.Text);//余额等于原余额+文本框的值 if (i > 0) { DateTime dtmNewestRenovateDate = DateTime.Now; OldDebtID = myFRM_YingShouGuanLi_JianZhangClient.btnConfirm_Click_Update_XiuGaiBuFenQianKuanXinXi( decAllHappenMoney, decBalance, dtmNewestRenovateDate, DebtID);//根据欠款ID修改欠款信息 if (OldDebtID > 0) { int intDebtID = DebtID; DateTime dtmHappenDate = DateTime.Now; string strOperateType = "发生欠款"; int intAtributeMinuteID_SourceClassify = 0; if (rbtnService.Checked == true) { intAtributeMinuteID_SourceClassify = 102; } if (rbtnSpareParts.Checked == true) { intAtributeMinuteID_SourceClassify = 106; } if (rbtnCustom.Checked == true) { intAtributeMinuteID_SourceClassify =104; } if (rbtnInsure.Checked == true) { intAtributeMinuteID_SourceClassify = 103; } if (rbtnReparation.Checked == true) { intAtributeMinuteID_SourceClassify = 105; } string BusinessOddlNumbers = "YW"; string strBusinessOddlNumbers = ShengChengDanHao(BusinessOddlNumbers); decimal decHappenMoney = Convert.ToDecimal(txtSpareMoney.Text.ToString().Trim()); decimal decFactReceiveMoney = 0; int intAttributeMinuteID_GatheringWay = 85; int intStaffID_GatheringPerson = PublicStaticObject .YuanGongID; OldDebtSetMealID = myFRM_YingShouGuanLi_JianZhangClient.btnConfirm_Click_Insert_XinZengQianKuanMingXiXinXi(intDebtID, dtmHappenDate, strOperateType, intAtributeMinuteID_SourceClassify, strBusinessOddlNumbers, decHappenMoney, decFactReceiveMoney, intAttributeMinuteID_GatheringWay, intStaffID_GatheringPerson);//新增欠款明细信息 } } else { decAllHappenMoney = Convert.ToDecimal(txtSpareMoney.Text); decimal decAllGatheringMoney = 0; decBalance = decAllHappenMoney; DateTime dtmNewestRenovateDate = DateTime.Now; DateTime dtmBuildAccountDate = DateTime.Now; int intCarOwnerNewsID = (int)cboClientCode.SelectedValue; NewDebtID = myFRM_YingShouGuanLi_JianZhangClient.btnConfirm_Click_Insert_XinZengQianKuanXinXi( decAllHappenMoney, decAllGatheringMoney, decBalance, dtmNewestRenovateDate, dtmBuildAccountDate, intCarOwnerNewsID);//新增欠款信息 if (NewDebtID > 0) { int intDebtID = NewDebtID; DateTime dtmHappenDate = DateTime.Now; string strOperateType = "发生欠款"; int intAtributeMinuteID_SourceClassify = 0; if (rbtnService.Checked == true) { intAtributeMinuteID_SourceClassify = 102; } if (rbtnSpareParts.Checked == true) { intAtributeMinuteID_SourceClassify = 106; } if (rbtnCustom.Checked == true) { intAtributeMinuteID_SourceClassify = 104; } if (rbtnInsure.Checked == true) { intAtributeMinuteID_SourceClassify = 103; } if (rbtnReparation.Checked == true) { intAtributeMinuteID_SourceClassify = 105; } string BusinessOddlNumbers = "YW"; string strBusinessOddlNumbers = ShengChengDanHao(BusinessOddlNumbers); decimal decHappenMoney = Convert.ToDecimal(txtSpareMoney.Text); decimal decFactReceiveMoney = 0; int intAttributeMinuteID_GatheringWay = 85; int intStaffID_GatheringPerson = PublicStaticObject.YuanGongID; NewDebtSetMealID = myFRM_YingShouGuanLi_JianZhangClient.btnConfirm_Click_Insert_XinZengQianKuanMingXiXinXi(intDebtID, dtmHappenDate, strOperateType, intAtributeMinuteID_SourceClassify, strBusinessOddlNumbers, decHappenMoney, decFactReceiveMoney, intAttributeMinuteID_GatheringWay, intStaffID_GatheringPerson);//新增欠款明细信息 } } if (OldDebtSetMealID > 0 || NewDebtSetMealID > 0) { BaoCunFou = true; MessageBox.Show("建账成功!!!"); this.Close(); } }
5、收款功能
先选择收款明细计算总额,然后进行收款。
第一步:界面层(UIL)代码
全选功能:
private void btnCheckAll_Click(object sender, EventArgs e)//全选 { for (int i = 0; i < dgvFinanceGatheringBillMinute.Rows.Count; i++) { dgvFinanceGatheringBillMinute.Rows[i].Cells["选择"].Value = true; } }
计算总额:
public static decimal HappenMoney ;//声明一个公共变量 private void btnQueDing_Click(object sender, EventArgs e) {//创建一个表,记录欠款结算ID和发生金额 if (PublicStaticObject.dtGatheringBillMinute.Columns.Count <= 0) { PublicStaticObject.dtGatheringBillMinute.Columns.Add("DebtSetMealID", typeof(int)); PublicStaticObject.dtGatheringBillMinute.Columns.Add("FactReceiveMoney", typeof(decimal)); } HappenMoney = 0; for (int i = 0; i < dgvFinanceGatheringBillMinute.Rows.Count; i++)//循环dgv,计算选择为真的发生金额总和 { if (Convert.ToBoolean(dgvFinanceGatheringBillMinute.Rows[i].Cells["选择"].Value) == true) { HappenMoney += Convert.ToDecimal(dgvFinanceGatheringBillMinute.Rows[i].Cells["发生金额"].Value);//计算金额之和 PublicStaticObject.dtGatheringBillMinute.Rows.Add(); int HangShu = PublicStaticObject.dtGatheringBillMinute.Rows.Count - 1; PublicStaticObject.dtGatheringBillMinute.Rows[HangShu]["DebtSetMealID"] = dgvFinanceGatheringBillMinute.Rows[i].Cells["欠款结算ID"].Value;//记录每个ID PublicStaticObject.dtGatheringBillMinute.Rows[HangShu]["FactReceiveMoney"] = dgvFinanceGatheringBillMinute.Rows[i].Cells["发生金额"].Value; //记录每个金额 } } if (HappenMoney > 0) { this.Close(); PublicStaticObject.Pub_FRM_YingShouGuanLi_ShouKuan = new FRM_YingShouGuanLi_ShouKuan(); PublicStaticObject.Pub_FRM_YingShouGuanLi_ShouKuan.Show(); } else { MessageBox.Show("请选择需要收款的信息!"); } }
收款功能:
第一步:数据库存储过程:
IF(@TYPE ='btnConfirm_Click_Update_IDXiuGaiQianKuanMingXi')BEGIN UPDATE PW_DebtSetMealList SET FactReceiveMoney=@FactReceiveMoney,Remarks=@Remarks, AttributeMinuteID_GatheringWay=@AttributeMinuteID_GatheringWay WHERE PW_DebtSetMealList.DebtSetMealID =@DebtSetMealIDENDIF(@TYPE ='btnConfirm_Click_Update_IDXiuGaiQianKuanXinXi')BEGIN UPDATE PW_DebtList SET AllGatheringMoney=@AllGatheringMoney,Balance=@Balance WHERE PW_DebtList.DebtID =@DebtIDEND
第二步:逻辑层(BLL)代码
[OperationContract] public int btnConfirm_Click_Update_IDXiuGaiQianKuanMingXi(decimal decFactReceiveMoney, string strRemarks,int intAttributeMinuteID_GatheringWay, int intDebtSetMealID) { SqlParameter[] mySqlParameters ={ new SqlParameter("@TYPE",SqlDbType.Char), new SqlParameter("@FactReceiveMoney",SqlDbType.Decimal), new SqlParameter("@Remarks",SqlDbType.Char), new SqlParameter ("@AttributeMinuteID_GatheringWay",SqlDbType .Int), new SqlParameter("@DebtSetMealID",SqlDbType.Int), }; mySqlParameters[0].Value = "btnConfirm_Click_Update_IDXiuGaiQianKuanMingXi"; mySqlParameters[1].Value = decFactReceiveMoney; mySqlParameters[2].Value = strRemarks; mySqlParameters[3].Value = intAttributeMinuteID_GatheringWay; mySqlParameters[4].Value = intDebtSetMealID; return myDALMethod.UpdateData("财务管理_FRM_YingShouGuanLi_ShouKuan", mySqlParameters); } [OperationContract] public int btnConfirm_Click_Update_IDXiuGaiQianKuanXinXi(decimal decAllGatheringMoney, decimal decBalance, int intDebtID) { SqlParameter[] mySqlParameters ={ new SqlParameter("@TYPE",SqlDbType.Char), new SqlParameter("@AllGatheringMoney",SqlDbType.Decimal), new SqlParameter("@Balance",SqlDbType.Decimal), new SqlParameter("@DebtID",SqlDbType.Int), }; mySqlParameters[0].Value = "btnConfirm_Click_Update_IDXiuGaiQianKuanXinXi"; mySqlParameters[1].Value = decAllGatheringMoney; mySqlParameters[2].Value = decBalance; mySqlParameters[3].Value = intDebtID; return myDALMethod.UpdateData("财务管理_FRM_YingShouGuanLi_ShouKuan", mySqlParameters); }
第三步:界面层(UIL)代码,写进Button单击事件
/// <summary> /// /// </summary> /// <param name="sender">触发者</param> /// <param name="e">触发事件</param> private void btnConfirm_Click(object sender, EventArgs e) { int intDebtID = FRM_YingShouGuanLi.intDebtID; decimal decAllHappenMoney = FRM_YingShouGuanLi.decAllHappenMoney; decimal AllGatheringMoney =FRM_YingShouGuanLi .decAllGatheringMoney + Convert.ToDecimal(txtFactReceiveMoney.Text); decimal decBalance = decAllHappenMoney - AllGatheringMoney; int j = myFRM_YingShouGuanLi_ShouKuanClient.btnConfirm_Click_Update_IDXiuGaiQianKuanXinXi(AllGatheringMoney, decBalance, intDebtID); int k = 0; for (int i = 0; i < PublicStaticObject.dtGatheringBillMinute.Rows.Count;i++ ) { int intAttributeMinuteID_GatheringWay = Convert.ToInt32(cboGatheringWay.SelectedValue); string strRemarks = txtGatheringRemarks.Text.ToString().Trim(); int DebtSetMealID = (int)PublicStaticObject.dtGatheringBillMinute.Rows[i]["DebtSetMealID"]; decimal decFactReceiveMoney = Convert.ToDecimal(PublicStaticObject.dtGatheringBillMinute.Rows[i]["FactReceiveMoney"]); k = myFRM_YingShouGuanLi_ShouKuanClient.btnConfirm_Click_Update_IDXiuGaiQianKuanMingXi(decFactReceiveMoney, strRemarks,intAttributeMinuteID_GatheringWay, DebtSetMealID); } DataTable dt = new DataTable(); PublicStaticObject.dtGatheringBillMinute = dt; BaoCunFou = true; if (j > 0 && k > 0) { MessageBox.Show("收银成功!!!"); this.Dispose(); this.Close(); } else { MessageBox.Show("收银失败!!!"); } }
仅用于学习参考,禁止用于商业用途!!
- 海马汽车经销商管理系统技术解析(三)应收管理
- 海马汽车经销商管理系统技术解析(十三)结算
- 海马汽车经销商管理系统技术解析(十四)出厂
- 海马汽车经销商管理系统技术解析(三)预约管理主界面数据加载及部分功能
- 海马汽车经销商管理系统技术解析(四)保养管理
- 海马汽车经销商管理系统技术解析(一)服务配置流程
- 海马汽车经销商管理系统技术解析(一)新建项目,搭建WCF架构
- 海马汽车经销商管理系统技术解析(二)登陆验证
- 海马汽车经销商管理系统技术解析(二)维修收银
- 海马汽车经销商管理系统技术解析(五)车辆续保提醒
- 海马汽车经销商管理系统技术解析(六)顾客生日祝贺
- 海马汽车经销商管理系统技术解析(七)投诉处理
- 海马汽车经销商管理系统技术解析(四)新增预约
- 海马汽车经销商管理系统技术解析(五)预约修改
- 海马汽车经销商管理系统技术解析(六)定位预约单
- 海马汽车经销商管理系统技术解析(七)预约失败处理
- 海马汽车经销商管理系统技术解析(八)预约变更
- 海马汽车经销商管理系统技术解析(九)预约单转维修工单
- ArrayList的类的简单使用
- Android EventBus 实战
- 两种高效的服务器设计模型:Reactor和Proactor模型
- n皇后问题(回溯法)
- 查看mysql表结构和表创建语句的方法
- 海马汽车经销商管理系统技术解析(三)应收管理
- spring AOP
- 读浅墨博客 十一 笔记(2)代码
- android 曲线图的绘制
- android EventBus源码解析
- 实现挂号管理窗体功能代码分析(三)
- 【移动开发者沙龙 北京站】第一期 移动应用性能优化笔记 火热报名中
- Android开源框架--ViewPagerIndicator的使用
- 自己工作的总结与前景