📄 editorder.cs
字号:
this.panel1.Controls.Add(this.label3);
this.panel1.Location = new System.Drawing.Point(9, 8);
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(544, 160);
this.panel1.TabIndex = 9;
//
// thisExecuteEr
//
this.thisExecuteEr.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.thisExecuteEr.Location = new System.Drawing.Point(296, 104);
this.thisExecuteEr.Name = "thisExecuteEr";
this.thisExecuteEr.Size = new System.Drawing.Size(240, 20);
this.thisExecuteEr.TabIndex = 14;
//
// writeDate
//
this.writeDate.Location = new System.Drawing.Point(72, 128);
this.writeDate.Name = "writeDate";
this.writeDate.Size = new System.Drawing.Size(128, 21);
this.writeDate.TabIndex = 7;
//
// allExes
//
this.allExes.Enabled = false;
this.allExes.Location = new System.Drawing.Point(296, 128);
this.allExes.Name = "allExes";
this.allExes.Size = new System.Drawing.Size(240, 21);
this.allExes.TabIndex = 8;
this.allExes.Text = "0.00";
//
// buyContactEr
//
this.buyContactEr.Location = new System.Drawing.Point(296, 80);
this.buyContactEr.Name = "buyContactEr";
this.buyContactEr.Size = new System.Drawing.Size(240, 21);
this.buyContactEr.TabIndex = 4;
this.buyContactEr.Text = "";
//
// buyEr
//
this.buyEr.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.buyEr.Enabled = false;
this.buyEr.Location = new System.Drawing.Point(296, 56);
this.buyEr.Name = "buyEr";
this.buyEr.Size = new System.Drawing.Size(240, 20);
this.buyEr.TabIndex = 2;
this.buyEr.SelectedIndexChanged += new System.EventHandler(this.buyEr_SelectedIndexChanged);
//
// label12
//
this.label12.Location = new System.Drawing.Point(216, 136);
this.label12.Name = "label12";
this.label12.Size = new System.Drawing.Size(80, 16);
this.label12.TabIndex = 13;
this.label12.Text = "货款总额计:";
//
// label11
//
this.label11.Location = new System.Drawing.Point(216, 112);
this.label11.Name = "label11";
this.label11.Size = new System.Drawing.Size(80, 13);
this.label11.TabIndex = 12;
this.label11.Text = "我方经办人:";
//
// label10
//
this.label10.Location = new System.Drawing.Point(8, 136);
this.label10.Name = "label10";
this.label10.Size = new System.Drawing.Size(72, 16);
this.label10.TabIndex = 10;
this.label10.Text = "签约日期:";
//
// packSign
//
this.packSign.Location = new System.Drawing.Point(72, 104);
this.packSign.Name = "packSign";
this.packSign.Size = new System.Drawing.Size(128, 21);
this.packSign.TabIndex = 5;
this.packSign.Text = "";
//
// pageSign
//
this.pageSign.Location = new System.Drawing.Point(72, 80);
this.pageSign.Name = "pageSign";
this.pageSign.Size = new System.Drawing.Size(128, 21);
this.pageSign.TabIndex = 3;
this.pageSign.Text = "";
//
// sign
//
this.sign.Enabled = false;
this.sign.Location = new System.Drawing.Point(72, 56);
this.sign.Name = "sign";
this.sign.Size = new System.Drawing.Size(128, 21);
this.sign.TabIndex = 1;
this.sign.Text = "";
//
// label9
//
this.label9.Location = new System.Drawing.Point(216, 88);
this.label9.Name = "label9";
this.label9.Size = new System.Drawing.Size(80, 16);
this.label9.TabIndex = 6;
this.label9.Text = "对方联系人:";
//
// label8
//
this.label8.Location = new System.Drawing.Point(216, 64);
this.label8.Name = "label8";
this.label8.Size = new System.Drawing.Size(80, 16);
this.label8.TabIndex = 5;
this.label8.Text = "购货商名称:";
//
// label7
//
this.label7.Location = new System.Drawing.Point(8, 112);
this.label7.Name = "label7";
this.label7.Size = new System.Drawing.Size(72, 16);
this.label7.TabIndex = 4;
this.label7.Text = "合同编号:";
//
// label6
//
this.label6.Location = new System.Drawing.Point(8, 88);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(72, 16);
this.label6.TabIndex = 3;
this.label6.Text = "凭证编号:";
//
// label5
//
this.label5.Location = new System.Drawing.Point(8, 64);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(72, 16);
this.label5.TabIndex = 2;
this.label5.Text = "信息编号:";
//
// label4
//
this.label4.Location = new System.Drawing.Point(136, 32);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(264, 8);
this.label4.TabIndex = 1;
this.label4.Text = "===========================================";
//
// label3
//
this.label3.Font = new System.Drawing.Font("宋体", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
this.label3.Location = new System.Drawing.Point(208, 8);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(100, 24);
this.label3.TabIndex = 0;
this.label3.Text = "销 售 单";
//
// timer1
//
this.timer1.Interval = 1000;
this.timer1.Tick += new System.EventHandler(this.timer1_Tick);
//
// EditOrder
//
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.ClientSize = new System.Drawing.Size(562, 519);
this.Controls.Add(this.button4);
this.Controls.Add(this.panel2);
this.Controls.Add(this.button3);
this.Controls.Add(this.modInfo);
this.Controls.Add(this.addInfo);
this.Controls.Add(this.button2);
this.Controls.Add(this.button1);
this.Controls.Add(this.list);
this.Controls.Add(this.panel1);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
this.MaximizeBox = false;
this.Name = "EditOrder";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "销售单";
this.Load += new System.EventHandler(this.EditOrder_Load);
this.panel2.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.list)).EndInit();
this.panel1.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
/// <summary>
/// 关闭窗口
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void button1_Click(object sender, System.EventArgs e) {
this.Close();
}
public void button4_Click(object sender, System.EventArgs e) {
//SelectSelfCompany cc = new SelectSelfCompany();
// cc.ShowDialog();
DataRow row = Public.GetCorpRow(Public.CutCorString(this.buyEr.Text,1));
DataRow my = Public.GetCorpRow(Public.currentSelfCorp);
this.rd = new ReportLibrary.ReportDocument(((DataTable)this.list.DataSource));
this.rd.RestoreProperty("SystemID=0SystemName=ReportID=0ReportCode=ReportName=ReportType=ReportMemo=PageTitle=PageSubTitle=PageHeader=PageFooter=GridPrintWhere=GridSelectStyle=GridPrintFields=GridTotalFields=GridChineseField=GridSortFields=GridPaginationFields=GridStatisticsFields=GridSumFields=GridRowToColFields=PdPropertys=PrinterName=EPSON LQ-1600KIIIPaperName=A4PaperWidth=827PaperHeight=1169PaperIsLandscape=falsePaperMargin.Left=40PaperMargin.Right=60PaperMargin.Top=55PaperMargin.Bottom=45");
this.rd.GridIsFillblank = false;
this.rd.PaperFooterIsNearGrid = true;
this.rd.PaperCols = 1;
this.rd.FontHeader = new Font("宋体",11F);
this.rd.FontGrid = new Font("宋体",11F);
this.rd.FontFooter = new Font("宋体",11F);
this.rd.FontTitle = new Font("黑体",20F,FontStyle.Bold);
this.rd.FontSubTitle = new Font("黑体",20F);
this.rd.DefaultPageSettings.Margins.Bottom = 31;
//页头
this.rd.PageHeader = "{[\\t宋体,4F] }{[\\n][\\c20][\\t宋体,13F]签 约 日 期 : "+ Public.SpaceForString(this._writeDate," ") +"}{[\\n][\\t宋体,4F] }{[\\n]甲 方: "+ Public.CutCorString(this.buyEr.Text,0) +"}{[\\l9][\\t黑体,15F]__________________________}";
this.rd.PageHeader += "{[\\l47]乙 方: "+ my["corName"].ToString() +"}{[\\l57][\\t黑体,15F]________________________}";
this.rd.PageHeader += "{[\\n][\\t宋体,6F] }{[\\n]兹因甲方向乙方定购下列货物,经双方协议订立本合同如下:}";
//页脚
this.rd.PageFooter = "{货款共计人民币(大写):}{[\\t宋体,11F,FontStyle.Bold]"+ Public.RMB(this.allExes.Text) +"}{[\\r10]小写:}{[\\t宋体,11F,FontStyle.Bold]"+ Public.NewJR(this.allExes.Text) +"}";
this.rd.PageFooter += "{[\\n][\\n]附注:本合同一式两份,甲、乙双方各执一份,盖章后及合同传真件同时生效。}";
this.rd.PageFooter += "{[\\n]本合约签定后按国家合同法规定执行,如有特殊情况应事先双方同意否则不得变更。}";
string __jhff = "";
if(this.rgMeans.Text.Trim().Length > 0) __jhff = "(交货方法:"+ this.rgMeans.Text +")";
this.rd.PageFooter += "{[\\n]交货地址:"+ this.rgPlace.Text + __jhff +"}{[\\l45]付款方法:"+ this.payMeans.Text +"}{[\\l8][\\t黑体,15F]_________________________}{[\\l54][\\t黑体,15F]__________________________}";
this.rd.PageFooter += "{[\\n]运 费:"+ this.yhzf.Text +"}{[\\l45]发票类型:"+ this.fplx.Text +"}{[\\l8][\\t黑体,15F]_________________________}{[\\l54][\\t黑体,15F]__________________________}";
//将备注分两行打印
string[] _memos = Public.CutAddressForPrint(this.memo.Text,30);
this.rd.PageFooter += "{[\\n]交货日期:"+ this.jht.Text +"}{[\\l45]备 注:"+ _memos[0].ToString() +"}{[\\l8][\\t黑体,15F]_________________________}{[\\l54][\\t黑体,15F]__________________________}";
if(_memos[1].ToString().Trim().Length > 0){
this.rd.PageFooter += "{[\\n]}{[\\l46]"+ _memos[1].ToString() +"}{[\\l45][\\t黑体,15F]_________________________________}";
}
this.rd.PageFooter += "{[\\n][\\n]甲 方:(单位盖章)}{[\\l45]乙 方:(单位盖章)}";
if(row == null){
MessageBox.Show("销售单中涉及的客户单位不存在,操作不能继续下去!");
return;
}
this.rd.PageFooter += "{[\\n]单位名称:"+ Public.CutCorString(this.buyEr.Text,0) +"}{[\\l45]单位名称:"+ my["corName"].ToString() +"}{[\\l8][\\t黑体,15F]_________________________}{[\\l54][\\t黑体,15F]__________________________}";
//计算地址的长度,如果够长岀分两行打印
string[] _address = Public.CutAddressForPrint(row["address"].ToString(),30);
this.rd.PageFooter += "{[\\n]详细地址:"+ _address[0].ToString() +"}{[\\l45]详细地址:"+ my["address"].ToString() +"}{[\\l8][\\t黑体,15F]_________________________}{[\\l54][\\t黑体,15F]__________________________}";
this.rd.PageFooter += "{[\\n]}{[\\l9]"+ _address[1] +"}{[\\l45]邮 编:"+ my["pcCode"].ToString() +"}{[\\l8][\\t黑体,15F]_________________________}{[\\l54][\\t黑体,15F]__________________________}";
this.rd.PageFooter += "{[\\n]邮 编:"+ row["pcCode"].ToString() +"}{[\\l45]电 话:"+ my["tel"].ToString() +"}{[\\l8][\\t黑体,15F]_________________________}{[\\l54][\\t黑体,15F]__________________________}";
this.rd.PageFooter += "{[\\n]电 话:"+ row["tel"].ToString() +"}{[\\l45]传 真:"+ my["fax"].ToString() +"}{[\\l8][\\t黑体,15F]_________________________}{[\\l54][\\t黑体,15F]__________________________}";
this.rd.PageFooter += "{[\\n]传 真:"+ row["fax"].ToString() +"}{[\\l45]开 户 行:"+ my["bankAccName"].ToString() +"}{[\\l8][\\t黑体,15F]_________________________}{[\\l54][\\t黑体,15F]__________________________}";
this.rd.PageFooter += "{[\\n]手 机:"+ row["mobileTel"].ToString() +"}{[\\l45]银行帐号:"+ my["bankAccNum"].ToString() +"}{[\\l8][\\t黑体,15F]_________________________}{[\\l54][\\t黑体,15F]__________________________}";
this.rd.PageFooter += "{[\\n]经 办 人:"+ this.buyContactEr.Text +"}{[\\l45]经 办 人:"+ this.thisExecuteEr.Text +"}{[\\l8][\\t黑体,15F]_________________________}{[\\l54][\\t黑体,15F]__________________________}";
this.rd.GridPrintFields = "规格,品名,数量,单位,单价,总额";
//this.rd.GridTotalFields = "总额";
string title = my["corName"].ToString();
if(title.Length <= 9){
title = Public.SpaceForString(my["corName"].ToString()," ");
}
this.rd.PageTitle = ""+ title +"";
this.rd.PageSubTitle = "订 货 合 同";
this.rd.GridSelectStyle = "规格.Align=居中,规格.MaxLength=8,品名.Align=居中,单位.Align=居中,单位.MaxLength=6,单价.MaxLength=10,单价.Align=居中,数量.Align=居中,数量.MaxLength=10,总额.MaxLength=10,总额.Align=居中";
this.rd.PageIsNumber = false;
this.rd.RowHeightMHeader = 1.5F;
this.rd.RowHeightMFooter = 1.5F;
this.rd.PageImage = Public.lyLogo;
//this.rd.GridIsFillblank = true;
//this.rd.SetPageFooterFont = new Font("宋体",10F);
//this.rd.SetPageFooterString = Public.GetPrintFooter();
rd.PrintPreview();
}
/// <summary>
/// 保存,保存基本信息和明细
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void button2_Click(object sender, System.EventArgs e) {
string sql = "";
//检查运费
if(this.txExes.Text.Trim().Replace("0.00","") == ""){
this.txExes.Text = "0.00";
}else{
try{
Decimal _txExes = Decimal.Parse(this.txExes.Text);
}catch{
MessageBox.Show("运费只能用数字(含小数点)表示!");
return;
}
}
if(this.autoID != null){
//保存新的
try{
sql = "Update SellOrder set pageSign='"+ this.pageSign.Text +"',pactSign='"+ this.packSign.Text +"',buySign='"+ Public.CutCorString(this.buyEr.Text,1) +"',buyName='"+ Public.CutCorString(this.buyEr.Text,0) +"',writeDate='"+ this.writeDate.Text +"',buyContactEr='"+ this.buyContactEr.Text +"',thisExecuteEr='"+ this.thisExecuteEr.Text +"',rgPlace='"+ this.rgPlace.Text +"',rgMeansName='"+ this.rgMeans.Text +"',rgDate='"+ this.rgDate.Text +"',payMeansName='"+ this.payMeans.Text +"',tsExes="+ this.txExes.Text +",allExes="+ this.allExes.Text +",content='"+ this.memo.Text +"',modifyEr='"+ Public.userID +"',modifyDate='"+ DateTime.Now.ToString() +"',fplx='"+ this.fplx.Text +"',hphm='"+ this.hphm.Text +"',yhzf='"+ this.yhzf.Text +"',jhrType='"+ this.jht.Text +"',fc1='"+ this.payStat.Text +"',fc2='"+ this.fc2.Text +"' where sosign='"+ this.sign.Text +"'";
Public.CloseConn();
Public.conn.Open();
OleDbCommand cmd = new OleDbCommand(sql,Public.conn);
cmd.ExecuteNonQuery();
Public.conn.Close();
}catch(Exception ex){
MessageBox.Show(ex.Message.ToString());
return;
}
//先删除当前编号下的所有明细
try{
sql = "delete from SellList where sellSign='"+ this.sign.Text +"'";
Public.CloseConn();
Public.conn.Open();
OleDbCommand cmd = new OleDbCommand(sql,Public.conn);
cmd.ExecuteNonQuery();
Public.conn.Close();
}catch(Exception ex){
MessageBox.Show("清空明细出借:" + ex.Message.ToString());
return;
}
}else{
try{
//检查编号的有效性和是否重复
if(!Public.SystemSignIsRight(this.sign.Text)){
MessageBox.Show("信息编号为空或格式不正确。" + Public.systemSignNotRight);
return;
}
sql = "select autoID from SellOrder where soSign='"+ this.sign.Text +"'";
OleDbDataAdapter ad = new OleDbDataAdapter(sql,Public.conn);
DataSet _ds = new DataSet();
ad.Fill(_ds,"sell");
if(_ds == null || _ds.Tables[0].Rows.Count > 0){
MessageBox.Show("信息编号有重复,不能保存!");
return;
}
sql = "Insert into SellOrder (pageSign,soSign,pactSign,buySign,buyName,writeDate,buyContactEr,thisExecuteEr,rgPlace,rgMeansName,rgDate,payMeansName,tsExes,allExes,content,addEr,addDate,fplx,hphm,yhzf,jhrType,fc1,fc2)";
sql += " values ('"+ this.pageSign.Text +"','"+ this.sign.Text +"','"+ this.packSign.Text +"','"+ Public.CutCorString(this.buyEr.Text,1) +"','"+ Public.CutCorString(this.buyEr.Text,0) +"','"+ this.writeDate.Text +"','"+ this.buyContactEr.Text +"','"+ this.thisExecuteEr.Text +"','"+ this.rgPlace.Text +"','"+ this.rgMeans.Text +"','"+ this.rgDate.Text +"','"+ this.payMeans.Text +"',"+ this.txExes.Text +","+ this.allExes.Text +",'"+ this.memo.Text +"','"+ Public.userID +"','"+ DateTime.Now.ToString() +"','"+ this.fplx.Text +"','"+ this.hphm.Text +"','"+ this.yhzf.Text +"','"+ this.jht.Text +"','"+ this.payStat.Text +"','"+ this.fc2.Text +"')";
Public.CloseConn();
Public.conn.Open();
OleDbCommand cmd = new OleDbCommand(sql,Public.conn);
cmd.ExecuteNonQuery();
Public.conn.Close();
}catch(Exception ex){
MessageBox.Show(ex.Message.ToString());
return;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -