| using System; | 
| using System.Collections.Generic; | 
| using System.ComponentModel; | 
| using System.Data; | 
| using System.Drawing; | 
| using System.Text; | 
| using System.Windows.Forms; | 
|   | 
| namespace WorkM | 
| { | 
|     public partial class Xs_SendGoodsPlan : Form | 
|     { | 
|         public Xs_SendGoodsPlan() | 
|         { | 
|             InitializeComponent(); | 
|         } | 
|   | 
|   | 
|         //¶¨ÒåÁÐ | 
|         public const Int16 FixCols = 12; | 
|         // | 
|         public const Int16 HTypeCol = 0; | 
|         public const Int16 HSourceIDCol = 1; | 
|         public const Int16 HSourceEntryIDCol = 2; | 
|         public const Int16 HSourceNameCol = 3; | 
|   | 
|         public const Int16 HMaterIDCol = 4; | 
|         public const Int16 HMaterNumberCol = 5; | 
|         public const Int16 HMaterNameCol = 6; | 
|         public const Int16 HMaterModelCol = 7; | 
|         public const Int16 HUnitIDCol = 8; | 
|         public const Int16 HUnitNumberCol = 9; | 
|         public const Int16 HUnitNameCol = 10; | 
|         public const Int16 HQtyCol = 11; | 
|   | 
|   | 
|         // | 
|         public string ModName = "1423"; | 
|         public string ModCaption = "ÏúÊÛ·¢»õ¼Æ»®"; | 
|         // | 
|         public DBUtility.ClsPub.Enum_BillStatus BillStatus; | 
|         public string sAllowCol=""; | 
|         // | 
|   | 
|         SQLHelper.ClsCN oCn = new SQLHelper.ClsCN(); | 
|   | 
|   | 
|         //³õʼ»¯Íø¸ñ | 
|         private void initGrid() | 
|         { | 
|             grdmain.ColumnCount = FixCols; | 
|             DBUtility.Xt_BaseBillFun.initGridFst(grdmain, this.Name); | 
|             DBUtility.Xt_BaseBillFun.initGridList(grdsub1, this.Name); | 
|             DBUtility.Xt_BaseBillFun.initGridList(grdsub2, this.Name);  | 
|             grdmain.BackgroundColor = Color.Lavender;              //Íø¸ñ±³¾°É« | 
|             grdmain.ColumnHeadersDefaultCellStyle.BackColor = Color.Beige; | 
|             grdmain.ClipboardCopyMode = DataGridViewClipboardCopyMode.EnableWithoutHeaderText; | 
|             grdmain.ReadOnly = false; | 
|             grdmain.RowCount = 0; | 
|             grdmain.Columns[HMaterNumberCol].HeaderText = "²úÆ·´úÂë"; | 
|             grdmain.Columns[HMaterNameCol].HeaderText = "²úÆ·Ãû³Æ"; | 
|             grdmain.Columns[HMaterModelCol].HeaderText = "¹æ¸ñÐͺÅ"; | 
|             grdmain.Columns[HUnitNumberCol].HeaderText = "µ¥Î»´úÂë"; | 
|             grdmain.Columns[HUnitNameCol].HeaderText = "µ¥Î»Ãû³Æ"; | 
|             grdmain.Columns[HSourceNameCol].HeaderText = "Ô´µ¥ºÅ"; | 
|             grdmain.Columns[HQtyCol].HeaderText = "¶©µ¥ÊýÁ¿"; | 
|             grdmain.Columns[HTypeCol].HeaderText = "²ð·Ö±ê¼Ç"; | 
|             // | 
|             //grdmain.Columns[0].Visible = false; | 
|             grdmain.Columns[HSourceIDCol].Visible = false; | 
|             grdmain.Columns[HSourceEntryIDCol].Visible = false; | 
|             grdmain.Columns[HMaterIDCol].Visible = false; | 
|             grdmain.Columns[HUnitIDCol].Visible = false;  | 
|             //grdmain.ReadOnly = true; | 
|             for (int i = 0; i < grdmain.ColumnCount; i++) | 
|             { | 
|                 grdmain.Columns[i].SortMode = DataGridViewColumnSortMode.Automatic; //ÁРÅÅÐòģʽ | 
|   | 
|             } | 
|             // | 
|             //  | 
|             DBUtility.ClsPub.GetGridView(grdsub2, this.Name + "grdsub2", DBUtility.ClsPub.AppPath); | 
|             DBUtility.ClsPub.GetGridView(grdsub1, this.Name + "grdsub1", DBUtility.ClsPub.AppPath); | 
|             DBUtility.ClsPub.GetGridView(grdmain, this.Name + "grdmain", DBUtility.ClsPub.AppPath); | 
|             LoadDateCol(grdmain, FixCols, 60); | 
|             grdmain.ColumnHeadersDefaultCellStyle.WrapMode = DataGridViewTriState.True;//±êÌâÐÐ×Ô¶¯»»ÐÐ | 
|   | 
|   | 
|             //ÉèÖÿɱà¼ÁÐ | 
|             sAllowCol = ","+HMaterNumberCol.ToString() + | 
|                             "," + HMaterNameCol.ToString() + | 
|                             "," + HMaterModelCol.ToString() + | 
|                             "," + HUnitNumberCol.ToString() + | 
|                             "," + HUnitNameCol.ToString() + | 
|                             "," + HSourceNameCol.ToString() + | 
|                             "," + HQtyCol.ToString()+","; | 
|             grdmain.Columns[11].Frozen = true; | 
|         } | 
|   | 
|         //¼ÓÔØ µ±ÔÂÈÕÆÚ | 
|         public static void LoadDateCol(DataGridView grdMain, int FixCols, int iDates) | 
|         { | 
|             DateTime bDate, eDate, dDate; | 
|             //grdMain.Cols = FixCols; | 
|             bDate = Convert.ToDateTime(DBUtility.ClsPub.GetServerDate(0)); | 
|             eDate = (DBUtility.ClsPub.isDate(bDate).AddDays(iDates)); | 
|             dDate = bDate; | 
|             // | 
|             grdMain.ColumnCount = grdMain.ColumnCount + 1; | 
|             dDate = (DBUtility.ClsPub.isDate(bDate).AddDays(0)); | 
|             grdMain.Columns[grdMain.ColumnCount - 1].Width = 40; | 
|             // | 
|             grdMain.Columns[grdMain.ColumnCount - 1].HeaderText = Convert.ToDateTime(dDate).ToString("MM-dd"); | 
|             grdMain.Columns[grdMain.ColumnCount - 1].Tag = Convert.ToDateTime(dDate).ToString("yyyy-MM-dd"); | 
|             //grdMain.set_ColData(grdMain.Cols - 1, Convert.ToDateTime(dDate).ToString("yyyy-MM-dd")); | 
|             // | 
|             for (int i = 1; i < iDates; i++) | 
|             { | 
|                 if (dDate.CompareTo(eDate) > 0) | 
|                     return; | 
|                 grdMain.ColumnCount = grdMain.ColumnCount + 1; | 
|                 grdMain.Columns[grdMain.ColumnCount - 1].Width = 40; | 
|                 dDate = (DBUtility.ClsPub.isDate(bDate).AddDays(i)); | 
|                 grdMain.Columns[grdMain.ColumnCount - 1].HeaderText = Convert.ToDateTime(dDate).ToString("MM-dd"); | 
|                 grdMain.Columns[grdMain.ColumnCount - 1].Tag = Convert.ToDateTime(dDate).ToString("yyyy-MM-dd"); | 
|                 //grdMain.set_TextMatrix(1, grdMain.Cols - 1, Convert.ToDateTime(dDate).ToString("yyyy-MM-dd")); | 
|             } | 
|   | 
|         } | 
|   | 
|         //¼ÓÔØ Ñ¡Ô´µ¥ | 
|         private void yd_Click(object sender, EventArgs e) | 
|         { | 
|             DAL.Cls_S_K3_SeOrder_PD oK3_SeOrder_PD = new DAL.Cls_S_K3_SeOrder_PD(); | 
|             //string sWhere = " And HDeptID=" + DBUtility.ClsPub.isLong(txtHDeptID.Tag) + " "; | 
|             string sWhere = ""; | 
|             if (oK3_SeOrder_PD.Refresh(sWhere))  //Ñ¡ÔñÔµ¥ | 
|             { | 
|                 FillSelectData(oK3_SeOrder_PD.oBillSelectColl); | 
|             } | 
|         } | 
|   | 
|         //¼ÓÔØ Ôµ¥µ½±¾µØ | 
|         private void FillSelectData(List<DBUtility.BillSelect> oList) | 
|         { | 
|             //  | 
|             bool sBool = false; | 
|             DataSet Ds; | 
|             SQLHelper.ClsCN oCn = new SQLHelper.ClsCN(); | 
|             foreach (DBUtility.BillSelect oSelectRow in oList) | 
|             { | 
|                 if (oSelectRow.BillType == "81") | 
|                 { | 
|                     sBool = false; | 
|                     //µÃµ½ÐÅÏ¢ | 
|                     Ds = oCn.RunProcReturn("select * from h_v_K3_SEOrder_PD where hmainid=" + oSelectRow.BillMainID + " and hsubid=" + oSelectRow.BillSubID, "h_v_K3_SEOrder_PD"); | 
|                     //дÈëÐÅÏ¢ | 
|                     for (int j = 0; j <= grdmain.RowCount - 1; j++) | 
|                     { | 
|                         if (DBUtility.ClsPub.isLong(grdmain.Rows[j].Cells[HSourceIDCol].Value) == DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HMainID"]) && DBUtility.ClsPub.isLong(grdmain.Rows[j].Cells[HSourceEntryIDCol].Value) == DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["hsubid"])) | 
|                         { | 
|                             sBool = true; | 
|                             MessageBox.Show("ÏúÊÛ¶©µ¥£º" + DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["µ¥¾ÝºÅ"]) + ",²úÆ·£º"+ DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["²úÆ·Ãû³Æ"]) +"ÒÑ´æÔÚ´ýÅżƻ®ÖУ¬²»ÔÊÐíÌí¼Ó£¡", "Ìáʾ"); | 
|                             break; | 
|                         } | 
|                     } | 
|                     if (sBool != true) | 
|                     { | 
|                         grdmain.RowCount = grdmain.RowCount + 1; | 
|                         Sub_WriteInForm(Ds.Tables[0], grdmain.RowCount - 1); | 
|                     } | 
|                 } | 
|             } | 
|         } | 
|         //¸ù¾ÝTABLEдÈë½çÃæ | 
|         private void Sub_WriteInForm(DataTable oTable, int i) | 
|         { | 
|             try | 
|             { | 
|                 ////¼ÓÔØ±íÌå  | 
|                 grdmain.Rows[i].Cells[HSourceIDCol].Value = oTable.Rows[0]["hmainid"].ToString(); | 
|                 grdmain.Rows[i].Cells[HSourceEntryIDCol].Value = oTable.Rows[0]["hsubid"].ToString(); | 
|                 grdmain.Rows[i].Cells[HSourceNameCol].Value = oTable.Rows[0]["µ¥¾ÝºÅ"].ToString(); | 
|                 grdmain.Rows[i].Cells[HMaterIDCol].Value = oTable.Rows[0]["HMaterID"].ToString(); | 
|                 grdmain.Rows[i].Cells[HMaterNumberCol].Value = oTable.Rows[0]["²úÆ·´úÂë"].ToString(); | 
|                 grdmain.Rows[i].Cells[HMaterNameCol].Value = oTable.Rows[0]["²úÆ·Ãû³Æ"].ToString(); | 
|                 grdmain.Rows[i].Cells[HMaterModelCol].Value = oTable.Rows[0]["¹æ¸ñÐͺÅ"].ToString(); | 
|                 grdmain.Rows[i].Cells[HUnitIDCol].Value = oTable.Rows[0]["HUnitID"].ToString(); | 
|                 grdmain.Rows[i].Cells[HUnitNameCol].Value = oTable.Rows[0]["µ¥Î»Ãû³Æ"].ToString(); | 
|                 grdmain.Rows[i].Cells[HUnitNumberCol].Value = oTable.Rows[0]["µ¥Î»´úÂë"].ToString();  | 
|                 //============ | 
|                 grdmain.Rows[i].Cells[HQtyCol].Value = oTable.Rows[0]["ÊýÁ¿"].ToString();  | 
|             } | 
|             catch (Exception e) | 
|             { | 
|                 MessageBox.Show(e.Message); | 
|             } | 
|         } | 
|   | 
|         private void timer1_Tick(object sender, EventArgs e) | 
|         { | 
|             timer1.Enabled = false; | 
|             //³õʼ»¯ | 
|             initGrid(); | 
|             ShowBill(); | 
|         } | 
|   | 
|         private void tc_Click(object sender, EventArgs e) | 
|         { | 
|             bool sClose=true; | 
|             for (int i = 0; i < grdmain.Rows.Count; i++) | 
|             { | 
|                 if (DBUtility.ClsPub.isStrNull(grdmain.Rows[i].Cells[HTypeCol].Value) == "ÒѲð·Ö") | 
|                 { | 
|                     if (MessageBox.Show("´æÔÚÒѲð·Öδ±£´æÊý¾Ý£¬ÊÇ·ñ·ÅÆú±£´æ£¿", "Ìáʾ", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK) | 
|                     { | 
|                         this.Close(); | 
|                     } | 
|                     else | 
|                     { | 
|                         sClose = false; | 
|                         break; | 
|                     } | 
|                 } | 
|             } | 
|             if (sClose == true) | 
|             { | 
|                 this.Close(); | 
|             } | 
|         } | 
|   | 
|         private void grdmain_CellBeginEdit(object sender, DataGridViewCellCancelEventArgs e) | 
|         { | 
|             //int i = grdmain.CurrentCell.ColumnIndex; | 
|             //string srow = "," + i.ToString() + ","; | 
|             //if (sAllowCol.IndexOf(srow) != -1) | 
|             //{ | 
|             //    e.Cancel = true; | 
|             //} | 
|             e.Cancel = true; | 
|         } | 
|   | 
|         private void bc_Click(object sender, EventArgs e) | 
|         { | 
|             string HBillType = "1423"; | 
|             long HInterID; | 
|             long HEntryID; | 
|             long HMaterID; | 
|             long HUnitID; | 
|             double HQty = 0; | 
|             DateTime HSendDate; | 
|             //ɾ³ý×÷·Ïµ¥¾Ý | 
|             oCn.RunProc("exec h_p_Xs_SendGoodsPlanBill_DropDel"); | 
|             for (int i = 0; i < grdmain.Rows.Count; i++) | 
|             { | 
|                 if (DBUtility.ClsPub.isStrNull(grdmain.Rows[i].Cells[HTypeCol].Value) == "ÒѲð·Ö") | 
|                 { | 
|                     HInterID = DBUtility.ClsPub.isLong(grdmain.Rows[i].Cells[HSourceIDCol].Value); | 
|                     HEntryID = DBUtility.ClsPub.isLong(grdmain.Rows[i].Cells[HSourceEntryIDCol].Value); | 
|                     HMaterID = DBUtility.ClsPub.isLong(grdmain.Rows[i].Cells[HMaterIDCol].Value); | 
|                     HUnitID = DBUtility.ClsPub.isLong(grdmain.Rows[i].Cells[HUnitIDCol].Value); | 
|                     //×÷·Ï | 
|                     oCn.RunProc("exec h_p_Xs_SendGoodsPlanBill_Del " + HInterID + "," + HEntryID + ",'" + DBUtility.ClsPub.CurUserName + "'"); | 
|                     for (int j = FixCols; j < grdmain.ColumnCount; j++) | 
|                     { | 
|                         HQty = DBUtility.ClsPub.isDoule(grdmain.Rows[i].Cells[j].Value); | 
|                         HSendDate = DBUtility.ClsPub.isDate(grdmain.Columns[j].Tag); | 
|                         if (HQty != 0) | 
|                         { | 
|                             //ÐÂÔö | 
|                             oCn.RunProc("exec h_p_Xs_SendGoodsPlanBill_AddNew " + HInterID + "," + HEntryID + "," + HMaterID + "," + HUnitID + "," + HQty + ",'" + HSendDate + "','" + DBUtility.ClsPub.CurUserName + "'"); | 
|                         } | 
|                     } | 
|                     grdmain.Rows[i].Cells[HTypeCol].Value = "Òѱ£´æ"; | 
|                 } | 
|             } | 
|             MessageBox.Show("±£´æÍê±Ï£¡","Ìáʾ"); | 
|         } | 
|   | 
|         private void cf_Click(object sender, EventArgs e) | 
|         { | 
|             if (grdmain.CurrentRow == null) | 
|                 return; | 
|             if (DBUtility.ClsPub.isStrNull(grdmain.Rows[grdmain.CurrentRow.Index].Cells[HTypeCol].Value) == "ÒÑÏÂÍÆ") | 
|             { | 
|                 MessageBox.Show("¸Ã¶©µ¥´æÔÚÒÑÏÂÍÆ¼Æ»®£¬²»ÔÊÐí²ð·Ö£¡"); | 
|                 return; | 
|             } | 
|   | 
|             Xs_SendGoodsPlan_CF oCF = new Xs_SendGoodsPlan_CF(); | 
|             oCF.txtHBillNo.Text = DBUtility.ClsPub.isStrNull(grdmain.Rows[grdmain.CurrentRow.Index].Cells[HSourceNameCol].Value); | 
|             oCF.txtHMaterID.Text = DBUtility.ClsPub.isStrNull(grdmain.Rows[grdmain.CurrentRow.Index].Cells[HMaterNameCol].Value); | 
|             oCF.txtHMaterID.Tag = DBUtility.ClsPub.isLong(grdmain.Rows[grdmain.CurrentRow.Index].Cells[HMaterIDCol].Value); | 
|             oCF.txtHMaterNumber.Text = DBUtility.ClsPub.isStrNull(grdmain.Rows[grdmain.CurrentRow.Index].Cells[HMaterNumberCol].Value); | 
|             oCF.txtHModel.Text = DBUtility.ClsPub.isStrNull(grdmain.Rows[grdmain.CurrentRow.Index].Cells[HMaterModelCol].Value); | 
|             oCF.txtHUnitID.Text = DBUtility.ClsPub.isStrNull(grdmain.Rows[grdmain.CurrentRow.Index].Cells[HUnitNameCol].Value); | 
|             oCF.txtHUnitID.Tag = DBUtility.ClsPub.isLong(grdmain.Rows[grdmain.CurrentRow.Index].Cells[HUnitIDCol].Value); | 
|             oCF.txtHQty.Text = DBUtility.ClsPub.isStrNull(grdmain.Rows[grdmain.CurrentRow.Index].Cells[HQtyCol].Value); | 
|             double HQty = 0; | 
|             DateTime HSendDate; | 
|             int r = 0; | 
|   | 
|             for (int j = FixCols; j < grdmain.ColumnCount; j++) | 
|             { | 
|                 HQty = DBUtility.ClsPub.isDoule(grdmain.Rows[grdmain.CurrentRow.Index].Cells[j].Value); | 
|                 HSendDate = DBUtility.ClsPub.isDate(grdmain.Columns[j].Tag); | 
|                 if (HQty != 0) | 
|                 { | 
|                     oCF.row[r, 0] = HSendDate.ToShortDateString(); | 
|                     oCF.row[r, 1] = HQty.ToString(); | 
|                     r = r + 1; | 
|                 } | 
|             } | 
|   | 
|             oCF.ShowDialog(); | 
|             if (oCF.isOk == true) | 
|             { | 
|                 for (int j = FixCols; j < grdmain.ColumnCount; j++) | 
|                 { | 
|                     grdmain.Rows[grdmain.CurrentRow.Index].Cells[j].Value = ""; | 
|                 } | 
|                 for (int i = 0; i < oCF.grdMain.Rows.Count; i++) | 
|                 { | 
|                     HQty = DBUtility.ClsPub.isDoule(oCF.grdMain.Rows[i].Cells[oCF.sHQtyCol].Value); | 
|                     HSendDate = DBUtility.ClsPub.isDate(oCF.grdMain.Rows[i].Cells[oCF.sHDateCol].Value); | 
|                     for (int j = FixCols; j < grdmain.ColumnCount; j++) | 
|                     { | 
|                         if (grdmain.Columns[j].Tag.ToString() == Convert.ToDateTime(HSendDate).ToString("yyyy-MM-dd")) | 
|                         { | 
|                             grdmain.Rows[grdmain.CurrentRow.Index].Cells[j].Value = HQty; | 
|                             break ; | 
|                         } | 
|                     } | 
|                 } | 
|                 grdmain.Rows[grdmain.CurrentRow.Index].Cells[HTypeCol].Value = "ÒѲð·Ö"; | 
|             } | 
|         } | 
|         private void ShowBill() | 
|         { | 
|             DataSet Ds; | 
|             Ds = oCn.RunProcReturn("select * from h_v_Xs_SendGoodsPlanView order by ÏúÊÛ¶©µ¥Ö÷ÄÚÂë,ÏúÊÛ¶©µ¥×ÓÄÚÂë", "h_v_Xs_SendGoodsPlanView", ref DBUtility.ClsPub.sErrInfo); | 
|             if (Ds == null) | 
|             { | 
|                 MessageBox.Show("´íÎóÔÒò£º" + DBUtility.ClsPub.sErrInfo); | 
|                 return; | 
|             } | 
|             if (Ds.Tables[0].Rows.Count == 0) | 
|             { | 
|                 return; | 
|             } | 
|             else | 
|             { | 
|                 long sHInterID = 0; | 
|                 long sHEntryID = 0; | 
|                 int row = 0; | 
|                 for (int i = 0; i < Ds.Tables[0].Rows.Count; i++) | 
|                 { | 
|                     if (i == 0) | 
|                     { | 
|                         sHInterID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[i]["ÏúÊÛ¶©µ¥Ö÷ÄÚÂë"]); | 
|                         sHEntryID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[i]["ÏúÊÛ¶©µ¥×ÓÄÚÂë"]); | 
|                         grdmain.RowCount = grdmain.RowCount + 1; | 
|   | 
|                         grdmain.Rows[row].Cells[HTypeCol].Value = Ds.Tables[0].Rows[i]["״̬"].ToString(); | 
|                         grdmain.Rows[row].Cells[HSourceIDCol].Value = Ds.Tables[0].Rows[i]["ÏúÊÛ¶©µ¥Ö÷ÄÚÂë"].ToString(); | 
|                         grdmain.Rows[row].Cells[HSourceEntryIDCol].Value = Ds.Tables[0].Rows[i]["ÏúÊÛ¶©µ¥×ÓÄÚÂë"].ToString(); | 
|                         grdmain.Rows[row].Cells[HSourceNameCol].Value = Ds.Tables[0].Rows[i]["ÏúÊÛ¶©µ¥ºÅ"].ToString(); | 
|                         grdmain.Rows[row].Cells[HMaterIDCol].Value = Ds.Tables[0].Rows[i]["HMaterID"].ToString(); | 
|                         grdmain.Rows[row].Cells[HMaterNumberCol].Value = Ds.Tables[0].Rows[i]["²úÆ·´úÂë"].ToString(); | 
|                         grdmain.Rows[row].Cells[HMaterNameCol].Value = Ds.Tables[0].Rows[i]["²úÆ·Ãû³Æ"].ToString(); | 
|                         grdmain.Rows[row].Cells[HMaterModelCol].Value = Ds.Tables[0].Rows[i]["¹æ¸ñÐͺÅ"].ToString(); | 
|                         grdmain.Rows[row].Cells[HUnitIDCol].Value = Ds.Tables[0].Rows[i]["HUnitID"].ToString(); | 
|                         grdmain.Rows[row].Cells[HUnitNameCol].Value = Ds.Tables[0].Rows[i]["µ¥Î»Ãû³Æ"].ToString(); | 
|                         grdmain.Rows[row].Cells[HUnitNumberCol].Value = Ds.Tables[0].Rows[i]["µ¥Î»´úÂë"].ToString(); | 
|                         grdmain.Rows[row].Cells[HQtyCol].Value = Ds.Tables[0].Rows[i]["¶©µ¥ÊýÁ¿"].ToString();  | 
|   | 
|                         for (int j = FixCols; j < grdmain.Columns.Count; j++) | 
|                         { | 
|                             if (DBUtility.ClsPub.isDate(Ds.Tables[0].Rows[i]["·¢»õÈÕÆÚ"]) == DBUtility.ClsPub.isDate(grdmain.Columns[j].Tag)) | 
|                             { | 
|                                 grdmain.Rows[row].Cells[j].Value = DBUtility.ClsPub.isDoule(Ds.Tables[0].Rows[i]["ÊýÁ¿"]); | 
|                                 break; | 
|                             } | 
|                         } | 
|                     } | 
|                     else | 
|                     { | 
|                         if (sHInterID == DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[i]["ÏúÊÛ¶©µ¥Ö÷ÄÚÂë"]) && sHEntryID == DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[i]["ÏúÊÛ¶©µ¥×ÓÄÚÂë"])) | 
|                         { | 
|                             if (DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[i]["״̬"]) == "ÒÑÏÂÍÆ") | 
|                             { | 
|                                 grdmain.Rows[row].Cells[HTypeCol].Value = Ds.Tables[0].Rows[i]["״̬"].ToString(); | 
|                             } | 
|                             for (int j = FixCols; j < grdmain.Columns.Count; j++) | 
|                             { | 
|                                 if (DBUtility.ClsPub.isDate(Ds.Tables[0].Rows[i]["·¢»õÈÕÆÚ"]) == DBUtility.ClsPub.isDate(grdmain.Columns[j].Tag)) | 
|                                 { | 
|                                     grdmain.Rows[row].Cells[j].Value = DBUtility.ClsPub.isDoule(Ds.Tables[0].Rows[i]["ÊýÁ¿"]); | 
|                                     break; | 
|                                 }  | 
|                             } | 
|                         } | 
|                         else | 
|                         { | 
|                             sHInterID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[i]["ÏúÊÛ¶©µ¥Ö÷ÄÚÂë"]); | 
|                             sHEntryID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[i]["ÏúÊÛ¶©µ¥×ÓÄÚÂë"]); | 
|                             grdmain.RowCount = grdmain.RowCount + 1; | 
|                             row = row + 1; | 
|   | 
|                             grdmain.Rows[row].Cells[HTypeCol].Value = Ds.Tables[0].Rows[i]["״̬"].ToString(); | 
|                             grdmain.Rows[row].Cells[HSourceIDCol].Value = Ds.Tables[0].Rows[i]["ÏúÊÛ¶©µ¥Ö÷ÄÚÂë"].ToString(); | 
|                             grdmain.Rows[row].Cells[HSourceEntryIDCol].Value = Ds.Tables[0].Rows[i]["ÏúÊÛ¶©µ¥×ÓÄÚÂë"].ToString(); | 
|                             grdmain.Rows[row].Cells[HSourceNameCol].Value = Ds.Tables[0].Rows[i]["ÏúÊÛ¶©µ¥ºÅ"].ToString(); | 
|                             grdmain.Rows[row].Cells[HMaterIDCol].Value = Ds.Tables[0].Rows[i]["HMaterID"].ToString(); | 
|                             grdmain.Rows[row].Cells[HMaterNumberCol].Value = Ds.Tables[0].Rows[i]["²úÆ·´úÂë"].ToString(); | 
|                             grdmain.Rows[row].Cells[HMaterNameCol].Value = Ds.Tables[0].Rows[i]["²úÆ·Ãû³Æ"].ToString(); | 
|                             grdmain.Rows[row].Cells[HMaterModelCol].Value = Ds.Tables[0].Rows[i]["¹æ¸ñÐͺÅ"].ToString(); | 
|                             grdmain.Rows[row].Cells[HUnitIDCol].Value = Ds.Tables[0].Rows[i]["HUnitID"].ToString(); | 
|                             grdmain.Rows[row].Cells[HUnitNameCol].Value = Ds.Tables[0].Rows[i]["µ¥Î»Ãû³Æ"].ToString(); | 
|                             grdmain.Rows[row].Cells[HUnitNumberCol].Value = Ds.Tables[0].Rows[i]["µ¥Î»´úÂë"].ToString(); | 
|                             grdmain.Rows[row].Cells[HQtyCol].Value = Ds.Tables[0].Rows[i]["¶©µ¥ÊýÁ¿"].ToString();  | 
|   | 
|                             for (int j = FixCols; j < grdmain.Columns.Count; j++) | 
|                             { | 
|                                 if (DBUtility.ClsPub.isDate(Ds.Tables[0].Rows[i]["·¢»õÈÕÆÚ"]) == DBUtility.ClsPub.isDate(grdmain.Columns[j].Tag)) | 
|                                 { | 
|                                     grdmain.Rows[row].Cells[j].Value = DBUtility.ClsPub.isDoule(Ds.Tables[0].Rows[i]["ÊýÁ¿"]); | 
|                                     break; | 
|                                 }  | 
|                             } | 
|                         } | 
|                     } | 
|   | 
|   | 
|                 } | 
|             } | 
|         } | 
|   | 
|         private void grdmain_CellClick(object sender, DataGridViewCellEventArgs e) | 
|         { | 
|             if (grdmain.CurrentRow == null) | 
|                 return; | 
|             DataSet Ds1; | 
|             DataSet Ds2; | 
|             long sHInterID; | 
|             long sHEntryID; | 
|             long sHItemID; | 
|             sHInterID = DBUtility.ClsPub.isLong(grdmain.Rows[grdmain.CurrentRow.Index].Cells[HSourceIDCol].Value); | 
|             sHEntryID = DBUtility.ClsPub.isLong(grdmain.Rows[grdmain.CurrentRow.Index].Cells[HSourceEntryIDCol].Value); | 
|             sHItemID = DBUtility.ClsPub.isLong(grdmain.Rows[grdmain.CurrentRow.Index].Cells[HMaterIDCol].Value); | 
|             Ds1 = oCn.RunProcReturn("select * from h_v_Xs_SendGoodsPlanView2 where hmainid=" + sHInterID + " and hsubid=" + sHEntryID, "h_v_Xs_SendGoodsPlanView2"); | 
|             Ds2 = oCn.RunProcReturn("select * from h_v_Xs_SendGoodsPlanView3 where hitemid=" + sHItemID , "h_v_Xs_SendGoodsPlanView3"); | 
|             grdsub1.DataSource = Ds1.Tables[0].DefaultView; | 
|             grdsub2.DataSource = Ds2.Tables[0].DefaultView; | 
|             //¶³½á | 
|             int FrCol = 0; | 
|             string s = ""; | 
|             DBUtility.Xt_BaseBillFun.DisplayGrid(grdsub1, this.Name, s, FrCol); | 
|             DBUtility.Xt_BaseBillFun.DisplayGrid(grdsub2, this.Name, s, FrCol); | 
|         } | 
|   | 
|         private void bclk_Click(object sender, EventArgs e) | 
|         { | 
|             //±£´æÁпí | 
|             DBUtility.Xt_BaseBillFun.SaveGrid(grdmain, this.Name); | 
|             DBUtility.Xt_BaseBillFun.SaveGrid(grdsub1, this.Name); | 
|             DBUtility.Xt_BaseBillFun.SaveGrid(grdsub2, this.Name); | 
|         } | 
|   | 
|         private void mrlk_Click(object sender, EventArgs e) | 
|         { | 
|             DBUtility.Xt_BaseBillFun.DefaultGridView(grdmain, this.Name); | 
|             DBUtility.Xt_BaseBillFun.DefaultGridView(grdsub1, this.Name); | 
|             DBUtility.Xt_BaseBillFun.DefaultGridView(grdsub2, this.Name); | 
|         } | 
|     } | 
| } |