Exemple #1
0
 private void XO004ButtonEdit_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e)
 {
     if (GetGridStatu() != BaseForm.GridStatu.gsBrowse)
     {
         string mType = GV_Body.GetFocusedRowCellValue("XO004").ToString();
         f2.SetMI      = new string[] { "POSXH", "001" };
         f2.SetMIParam = new string[] { mType };
         f2.SetMuity   = true;
         Dictionary <int, List <string> > muity = null;
         if (f2.GetMI)
         {
             muity = f2.GetMuity;
             bool IsExist = false;
             bool IsFirst = true;
             foreach (KeyValuePair <int, List <string> > s in muity)
             {
                 for (int i = 0; i < GV_Body.RowCount; i++)
                 {
                     if ((GV_Body.GetRowCellValue(i, "XO005") == null))
                     {
                         IsExist = false;
                         break;
                     }
                     if (GV_Body.GetRowCellValue(i, "XO005").ToString() == s.Value[0])
                     {
                         if (GV_Body.GetRowCellValue(i, "XO004").ToString() == mType)
                         {
                             IsExist = true;
                             break;
                         }
                     }
                 }
                 if (IsExist)
                 {
                     IsExist = false;
                     continue;
                 }
                 else
                 {
                     if (IsFirst)
                     {
                         IsFirst = false;
                     }
                     else
                     {
                         GV_Body.AddNewRow();
                     }
                     GV_Body.SetFocusedRowCellValue("XO001", XN001.Text);
                     GV_Body.SetFocusedRowCellValue("XO002", XN002.EditValue);
                     GV_Body.SetFocusedRowCellValue("XO003", XN003.Text);
                     GV_Body.SetFocusedRowCellValue("XO004", mType);
                     GV_Body.SetFocusedRowCellValue("XO005", s.Value[0]);
                     GV_Body.SetFocusedRowCellValue("XO005C", s.Value[1]);
                     GV_Body.UpdateCurrentRow();
                 }
             }
         }
     }
 }
Exemple #2
0
 public override void GV_Body_InitNewRow(object sender, InitNewRowEventArgs e)
 {
     base.GV_Body_InitNewRow(sender, e);
     GV_Body.SetFocusedRowCellValue("XB001", XA001.Text);
     GV_Body.SetFocusedRowCellValue("XB002", string.Format("{0:0000}", GV_Body.RowCount));
     GV_Body.SetFocusedRowCellValue("XB006", XA002.Text);
     GV_Body.UpdateCurrentRow();
     GV_Body.FocusedColumn = GV_Body.Columns["XB007"];
     GV_Body.ShowEditor();
 }
Exemple #3
0
        private void XG009ButtonEdit_ButtonClick(object sender, ButtonPressedEventArgs e)
        {
            if (GetGridStatu() != BaseForm.GridStatu.gsBrowse)
            {
                try
                {
                    GV_Body.UpdateCurrentRow();
                    f2.SetMI      = new string[] { "POSXN", "001" };
                    f2.SetMIParam = new string[] { XF002.Text, "1", GV_Body.GetFocusedRowCellValue("XB007").ToString(),
                                                   "2", GV_Body.GetFocusedRowCellValue("XG002").ToString() };
                    f2.SetShowWindow = false;
                    if (f2.GetMI)
                    {
                        string   mXN002   = f2.GetReturn[2];
                        string   mXN003   = f2.GetReturn[3];
                        double   money    = 0;
                        double   mXB004   = 0;
                        double   mQty     = 0;
                        string   MarkInfo = "";
                        RESAI04I ai04i    = new RESAI04I();
                        string   mXG001   = GV_Body.GetFocusedRowCellValue("XG001").ToString();
                        string   mXG010   = GV_Body.GetFocusedRowCellValue("XG010").ToString();
                        string   mXG002   = GV_Body.GetFocusedRowCellValue("XG002").ToString();
                        ai04i.DefaultData = new List <string>()
                        {
                            mXG001, mXG010, mXG002, XF002.Text, mXN002, mXN003
                        };
                        DataTable dtPOSXK       = new DataTable("POSXK");
                        GridView  gridViewTests = null;
                        float     mXH004        = 0;
                        for (int i = 0; i < dS_RESAI04.POSXK.Columns.Count; i++)
                        {
                            dtPOSXK.Columns.Add(dS_RESAI04.POSXK.Columns[i].ColumnName, dS_RESAI04.POSXK.Columns[i].DataType);
                        }
                        //if (!GV_Body.IsMasterRowEmpty(GV_Body.FocusedRowHandle))
                        {
                            GV_Body.SetMasterRowExpanded(GV_Body.FocusedRowHandle, true);
                            gridViewTests = GV_Body.GetDetailView(GV_Body.FocusedRowHandle, 0) as GridView;
                            if (gridViewTests != null)
                            {
                                for (int i = 0; i < gridViewTests.RowCount; i++)
                                {
                                    int idx = gridViewTests.GetRowHandle(i);
                                    float.TryParse(gridViewTests.GetRowCellValue(idx, "XH004").ToString(), out mXH004);
                                    dtPOSXK.Rows.Add(new object[]
                                                     { "", "", "", "", "", "", 0, "", "", "", "", //});
                                                       gridViewTests.GetRowCellValue(idx, "XK001").ToString(),
                                                       gridViewTests.GetRowCellValue(idx, "XK002").ToString(),
                                                       gridViewTests.GetRowCellValue(idx, "XK003").ToString(),
                                                       gridViewTests.GetRowCellValue(idx, "XK004").ToString(),
                                                       gridViewTests.GetRowCellValue(idx, "XK005").ToString(),
                                                       gridViewTests.GetRowCellValue(idx, "XK006").ToString(),
                                                       gridViewTests.GetRowCellValue(idx, "XK006C").ToString(),
                                                       mXH004 });
                                }
                            }
                        }
                        ai04i.SetPOSXK = dtPOSXK;
                        if (ai04i.ShowDialog() == DialogResult.OK)
                        {
                            dtPOSXK = ai04i.SetPOSXK;

                            while (gridViewTests.RowCount != 0)
                            {
                                gridViewTests.SelectAll();
                                gridViewTests.DeleteSelectedRows();
                            }
                            for (int i = 0; i < dtPOSXK.Rows.Count; i++)
                            {
                                gridViewTests.BeginUpdate();
                                gridViewTests.AddNewRow();
                                gridViewTests.SetFocusedRowCellValue("COMPANY", dtPOSXK.Rows[i]["COMPANY"]);
                                gridViewTests.SetFocusedRowCellValue("CREATOR", dtPOSXK.Rows[i]["CREATOR"]);
                                gridViewTests.SetFocusedRowCellValue("USR_GROUP", dtPOSXK.Rows[i]["USR_GROUP"]);
                                gridViewTests.SetFocusedRowCellValue("CREATE_DATE", dtPOSXK.Rows[i]["CREATE_DATE"]);
                                gridViewTests.SetFocusedRowCellValue("MODIFIER", dtPOSXK.Rows[i]["MODIFIER"]);
                                gridViewTests.SetFocusedRowCellValue("MODI_DATE", dtPOSXK.Rows[i]["MODI_DATE"]);
                                gridViewTests.SetFocusedRowCellValue("FLAG", dtPOSXK.Rows[i]["FLAG"]);
                                gridViewTests.SetFocusedRowCellValue("CREATE_TIME", dtPOSXK.Rows[i]["CREATE_TIME"]);
                                gridViewTests.SetFocusedRowCellValue("MODI_TIME", dtPOSXK.Rows[i]["MODI_TIME"]);
                                gridViewTests.SetFocusedRowCellValue("TRANS_TYPE", dtPOSXK.Rows[i]["TRANS_TYPE"]);
                                gridViewTests.SetFocusedRowCellValue("TRANS_NAME", dtPOSXK.Rows[i]["TRANS_NAME"]);
                                gridViewTests.SetFocusedRowCellValue("XK001", dtPOSXK.Rows[i]["XK001"]);
                                gridViewTests.SetFocusedRowCellValue("XK002", dtPOSXK.Rows[i]["XK002"]);
                                gridViewTests.SetFocusedRowCellValue("XK003", dtPOSXK.Rows[i]["XK003"]);
                                gridViewTests.SetFocusedRowCellValue("XK004", dtPOSXK.Rows[i]["XK004"]);
                                gridViewTests.SetFocusedRowCellValue("XK005", dtPOSXK.Rows[i]["XK005"]);
                                gridViewTests.SetFocusedRowCellValue("XK006", dtPOSXK.Rows[i]["XK006"]);
                                gridViewTests.SetFocusedRowCellValue("XK006C", dtPOSXK.Rows[i]["XK006C"]);
                                gridViewTests.SetFocusedRowCellValue("XH004", dtPOSXK.Rows[i]["XH004"]);
                                money    += float.Parse(dtPOSXK.Rows[i]["XH004"].ToString());
                                MarkInfo += dtPOSXK.Rows[i]["XK006C"].ToString() + ",";
                                gridViewTests.EndUpdate();
                                gridViewTests.UpdateCurrentRow();
                            }
                            mXB004 = float.Parse(GV_Body.GetFocusedRowCellValue("XB004").ToString());
                            mQty   = float.Parse(GV_Body.GetFocusedRowCellValue("XG003").ToString());;
                            money += mXB004;
                            GV_Body.SetFocusedRowCellValue("XG004", money * mQty);
                            GV_Body.SetFocusedRowCellValue("XG009", MarkInfo);
                            GV_Body.UpdateCurrentRow();
                        }
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message.ToString());
                    fc.ErrorLog(ex.Message);
                }
            }
        }