📄 editorder.cs
字号:
this.payStat.TabIndex = 31;
//
// button5
//
this.button5.BackColor = System.Drawing.Color.Gainsboro;
this.button5.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.button5.Location = new System.Drawing.Point(224, 56);
this.button5.Name = "button5";
this.button5.Size = new System.Drawing.Size(80, 23);
this.button5.TabIndex = 30;
this.button5.Text = "<<<";
this.button5.Click += new System.EventHandler(this.button5_Click);
//
// jht
//
this.jht.Location = new System.Drawing.Point(72, 56);
this.jht.Name = "jht";
this.jht.Size = new System.Drawing.Size(152, 20);
this.jht.TabIndex = 11;
//
// yhzf
//
this.yhzf.Location = new System.Drawing.Point(368, 32);
this.yhzf.Name = "yhzf";
this.yhzf.Size = new System.Drawing.Size(80, 20);
this.yhzf.TabIndex = 16;
//
// hphm
//
this.hphm.Location = new System.Drawing.Point(72, 104);
this.hphm.Name = "hphm";
this.hphm.Size = new System.Drawing.Size(152, 21);
this.hphm.TabIndex = 13;
this.hphm.Text = "";
//
// fplx
//
this.fplx.Location = new System.Drawing.Point(72, 80);
this.fplx.Name = "fplx";
this.fplx.Size = new System.Drawing.Size(152, 20);
this.fplx.TabIndex = 12;
//
// label2
//
this.label2.Location = new System.Drawing.Point(8, 112);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(72, 16);
this.label2.TabIndex = 24;
this.label2.Text = "发票号码:";
//
// label1
//
this.label1.Location = new System.Drawing.Point(8, 88);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(72, 16);
this.label1.TabIndex = 23;
this.label1.Text = "发票类型:";
//
// rgDate
//
this.rgDate.Location = new System.Drawing.Point(304, 56);
this.rgDate.Name = "rgDate";
this.rgDate.Size = new System.Drawing.Size(232, 21);
this.rgDate.TabIndex = 17;
//
// payMeans
//
this.payMeans.Location = new System.Drawing.Point(304, 8);
this.payMeans.Name = "payMeans";
this.payMeans.Size = new System.Drawing.Size(120, 20);
this.payMeans.TabIndex = 14;
//
// rgMeans
//
this.rgMeans.Location = new System.Drawing.Point(72, 32);
this.rgMeans.Name = "rgMeans";
this.rgMeans.Size = new System.Drawing.Size(152, 20);
this.rgMeans.TabIndex = 10;
//
// rgPlace
//
this.rgPlace.Location = new System.Drawing.Point(72, 8);
this.rgPlace.Name = "rgPlace";
this.rgPlace.Size = new System.Drawing.Size(152, 20);
this.rgPlace.TabIndex = 9;
//
// memo
//
this.memo.Location = new System.Drawing.Point(304, 80);
this.memo.Multiline = true;
this.memo.Name = "memo";
this.memo.Size = new System.Drawing.Size(232, 40);
this.memo.TabIndex = 18;
this.memo.Text = "";
//
// txExes
//
this.txExes.Location = new System.Drawing.Point(304, 32);
this.txExes.Name = "txExes";
this.txExes.Size = new System.Drawing.Size(64, 21);
this.txExes.TabIndex = 15;
this.txExes.Text = "0.00";
//
// label18
//
this.label18.Location = new System.Drawing.Point(240, 80);
this.label18.Name = "label18";
this.label18.Size = new System.Drawing.Size(72, 16);
this.label18.TabIndex = 8;
this.label18.Text = "备 注:";
//
// label17
//
this.label17.Location = new System.Drawing.Point(240, 40);
this.label17.Name = "label17";
this.label17.Size = new System.Drawing.Size(72, 16);
this.label17.TabIndex = 7;
this.label17.Text = "运 费:";
//
// label16
//
this.label16.Location = new System.Drawing.Point(240, 16);
this.label16.Name = "label16";
this.label16.Size = new System.Drawing.Size(72, 16);
this.label16.TabIndex = 6;
this.label16.Text = "付款方法:";
//
// label15
//
this.label15.Location = new System.Drawing.Point(8, 64);
this.label15.Name = "label15";
this.label15.Size = new System.Drawing.Size(72, 16);
this.label15.TabIndex = 5;
this.label15.Text = "交货日期:";
//
// label14
//
this.label14.Location = new System.Drawing.Point(8, 40);
this.label14.Name = "label14";
this.label14.Size = new System.Drawing.Size(72, 16);
this.label14.TabIndex = 4;
this.label14.Text = "交货方法:";
//
// label13
//
this.label13.Location = new System.Drawing.Point(8, 16);
this.label13.Name = "label13";
this.label13.Size = new System.Drawing.Size(72, 16);
this.label13.TabIndex = 3;
this.label13.Text = "交货地址:";
//
// button4
//
this.button4.Location = new System.Drawing.Point(456, 448);
this.button4.Name = "button4";
this.button4.Size = new System.Drawing.Size(48, 23);
this.button4.TabIndex = 8;
this.button4.Text = "打 印";
this.button4.Click += new System.EventHandler(this.button4_Click);
//
// 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(560, 479);
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.panel1.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.list)).EndInit();
this.panel2.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.stocker.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.IsPdNeedSave = true;
//
//页头
this.rd.PageHeader = "{[\\t宋体,4F] }{[\\n][\\c20][\\t宋体,13F]签 约 日 期 : "+ Public.SpaceForString(this._writeDate," ") +"}{[\\n][\\t宋体,4F] }{[\\n]甲 方:"+ Public.CutCorString(this.stocker.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.rgDate.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.stocker.Text,0) +"}{[\\l45]单位名称:"+ my["corName"].ToString() +"}{[\\l8][\\t黑体,15F]_________________________}{[\\l54][\\t黑体,15F]__________________________}";
//计算地址的长度,如果够长岀分两行打印
string[] _address = Public.CutAddressForPrint(row["address"].ToString(),30);
this.rd.PageFooter += "{[\\n]详细地址:"+ row["address"].ToString() +"}{[\\l45]详细地址:"+ my["address"].ToString() +"}{[\\l8][\\t黑体,15F]_________________________}{[\\l54][\\t黑体,15F]__________________________}";
this.rd.PageFooter += "{[\\n]邮 编:"+ row["pcCode"].ToString() +"}{[\\l45]邮 编:"+ my["pcCode"].ToString() +"}{[\\l8][\\t黑体,15F]_________________________}{[\\l54][\\t黑体,15F]__________________________}";
this.rd.PageFooter += "{[\\n]电 话:"+ row["tel"].ToString() +"}{[\\l45]电 话:"+ my["tel"].ToString() +"}{[\\l8][\\t黑体,15F]_________________________}{[\\l54][\\t黑体,15F]__________________________}";
this.rd.PageFooter += "{[\\n]传 真:"+ row["fax"].ToString() +"}{[\\l45]传 真:"+ my["fax"].ToString() +"}{[\\l8][\\t黑体,15F]_________________________}{[\\l54][\\t黑体,15F]__________________________}";
this.rd.PageFooter += "{[\\n]手 机:"+ row["mobileTel"].ToString() +"}{[\\l45]开户银行:"+ my["bankAccName"].ToString() +"}{[\\l8][\\t黑体,15F]_________________________}{[\\l54][\\t黑体,15F]__________________________}";
this.rd.PageFooter += "{[\\n]开户银行:"+ row["openBank"].ToString() +"}{[\\l45]开户帐号:"+ my["bankAccNum"].ToString() +"}{[\\l8][\\t黑体,15F]_________________________}{[\\l54][\\t黑体,15F]__________________________}";
this.rd.PageFooter += "{[\\n]开户帐号:"+ row["bankAccNum"].ToString() +"}{[\\l45]网 址:"+ my["http"].ToString() +"}{[\\l8][\\t黑体,15F]_________________________}{[\\l54][\\t黑体,15F]__________________________}";
this.rd.PageFooter += "{[\\n]网 址:"+ row["http"].ToString() +"}{[\\l45]邮 箱:"+ my["email"].ToString() +"}{[\\l8][\\t黑体,15F]_________________________}{[\\l54][\\t黑体,15F]__________________________}";
this.rd.PageFooter += "{[\\n]经 办 人:"+ this.stockContactEr.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,数量.MaxLength=10,数量.Align=居中,单价.Align=居中,总额.MaxLength=10";
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 = System.Decimal.Parse(this.txExes.Text);
}catch(Exception ex){
MessageBox.Show("运费只能用数字(含小数点)表示!\n\n系统提示:" + ex.Message.ToString());
return;
}
}
if(this.autoID != null){
//保存新的
try{
sql = "Update StockOrder set pageSign='"+ this.pageSign.Text +"',pactSign='"+ this.packSign.Text +"',offerSign='"+ Public.CutCorString(this.stocker.Text,1) +"',offerName='"+ Public.CutCorString(this.stocker.Text,0) +"',writeDate='"+ this.writeDate.Text +"',offerContactEr='"+ this.stockContactEr.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 StockList where stockSign='"+ 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 StockOrder 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){
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -