コード例 #1
0
        private void FrmJournalVoucher_Load(object sender, EventArgs e)
        {
            ProjectFunctions.ToolStripVisualize(Menu_ToolStrip);
            ProjectFunctions.TextBoxVisualize(panelControl1);
            ProjectFunctions.TextBoxVisualize(panelControl2);
            ProjectFunctions.TextBoxVisualize(this);

            if (S1 == "&Add")
            {
                txtVoucherDate.EditValue = DateTime.Now;
                txtVoucherNo.Text        = GetNewInvoiceDocumentNo().ToString();
                txtVoucherTypeCode.Select();
            }
            else
            {
                txtVoucherDate.Enabled     = false;
                txtVoucherTypeCode.Enabled = false;
                var     str = "[sp_LoadJournalVouDataFEditing] @VumNo='" + VoucherNo + "',@VumDate='" + Convert.ToDateTime(VoucherDate).ToString("yyyy-MM-dd") + "'";
                DataSet ds  = ProjectFunctions.GetDataSet(str);
                txtVoucherNo.Text       = VoucherNo;
                txtVoucherDate.Text     = Convert.ToDateTime(ds.Tables[0].Rows[0]["VumDate"]).ToString("yyyy-MM-dd");
                txtVoucherTypeCode.Text = ds.Tables[0].Rows[0]["VumType"].ToString();
                txtVoucherTypeDesc.Text = ds.Tables[0].Rows[0]["VouDesc"].ToString();
                txtShortNarration.Text  = ds.Tables[0].Rows[0]["ShortNarration"].ToString();
                txtLongNarration.Text   = ds.Tables[0].Rows[0]["LongNarration"].ToString();
                txtCatgCode.Text        = ds.Tables[0].Rows[0]["VumCatgCode"].ToString();
                txtCatgDesc.Text        = ds.Tables[0].Rows[0]["CatgDesc"].ToString();
                if (ds.Tables[1].Rows.Count > 0)
                {
                    ds.Tables[1].Columns.Add("Debit", typeof(Decimal));
                    ds.Tables[1].Columns.Add("Credit", typeof(Decimal));


                    foreach (DataRow dr in ds.Tables[1].Rows)
                    {
                        if (Convert.ToDecimal(dr["Amount"]) < 0)
                        {
                            dr["CRDR"]   = "CR";
                            dr["Credit"] = -Convert.ToDecimal(dr["Amount"]);
                            dr["Debit"]  = -Convert.ToDecimal("0");
                        }
                        if (Convert.ToDecimal(dr["Amount"]) > 0)
                        {
                            dr["CRDR"]   = "DR";
                            dr["Debit"]  = Convert.ToDecimal(dr["Amount"]);
                            dr["Credit"] = -Convert.ToDecimal("0");
                        }
                    }
                    dt = ds.Tables[1];
                    VoucherGrid.DataSource = dt;
                    VoucherGridView.BestFitColumns();
                }



                txtCatgCode.Focus();
            }
        }
コード例 #2
0
        private void VoucherGridView_ValidatingEditor(object sender, DevExpress.XtraEditors.Controls.BaseContainerValidateEditorEventArgs e)
        {
            DataRow currentrow = VoucherGridView.GetDataRow(VoucherGridView.FocusedRowHandle);

            if (VoucherGridView.FocusedColumn.FieldName == "AccCode")
            {
                VoucherGridView.SetRowCellValue(VoucherGridView.FocusedRowHandle, VoucherGridView.Columns["CRDR"], SetCrDrValue());
            }
        }
コード例 #3
0
 private void VoucherGrid_EditorKeyDown(object sender, KeyEventArgs e)
 {
     if (e.KeyCode == Keys.Enter)
     {
         if (VoucherGridView.FocusedColumn.FieldName == "Credit" || VoucherGridView.FocusedColumn.FieldName == "Debit")
         {
             VoucherGridView.FocusedColumn = VoucherGridView.Columns["Narration"];
             VoucherGridView.ShowEditor();
         }
     }
 }
コード例 #4
0
        private void HelpGrid_DoubleClick(object sender, EventArgs e)
        {
            HelpGridView.CloseEditor();
            HelpGridView.UpdateCurrentRow();
            DataRow row = HelpGridView.GetDataRow(HelpGridView.FocusedRowHandle);

            if (HelpGrid.Text == "txtVoucherTypeCode")
            {
                txtVoucherTypeCode.Text = row["VouCode"].ToString();
                txtVoucherTypeDesc.Text = row["VouDesc"].ToString();
                HelpGrid.Visible        = false;
                panelControl2.Visible   = false;
                txtAccountCode.Focus();
            }
            if (HelpGrid.Text == "txtAccountCode")
            {
                txtAccountCode.Text   = row["AccCode"].ToString();
                txtAccountName.Text   = row["AccName"].ToString();
                HelpGrid.Visible      = false;
                panelControl2.Visible = false;
                txtShortNarration.Focus();
            }

            if (HelpGrid.Text == "AccCode")
            {
                if (HelpGridView.RowCount > 0)
                {
                    DataRow dtNewRow = dt.NewRow();
                    dtNewRow["AccCode"]   = row["AccCode"].ToString();
                    dtNewRow["AccName"]   = row["AccName"].ToString();
                    dtNewRow["Amount"]    = Convert.ToDecimal("0.00");
                    dtNewRow["Narration"] = string.Empty;
                    dtNewRow["CRDR"]      = SetCrDrValue();

                    dt.Rows.Add(dtNewRow);
                    if (dt.Rows.Count > 0)
                    {
                        VoucherGrid.DataSource = dt;
                        VoucherGridView.BestFitColumns();
                    }
                    else
                    {
                        VoucherGrid.DataSource = null;
                        VoucherGridView.BestFitColumns();
                    }
                    panelControl2.Visible = false;
                    VoucherGridView.Focus();
                    VoucherGridView.MoveLast();
                    VoucherGridView.FocusedColumn = VoucherGridView.Columns["Amount"];
                    VoucherGridView.ShowEditor();
                    txtSearchBox.Text = string.Empty;
                }
            }
        }
コード例 #5
0
 private void VoucherGridView_PopupMenuShowing(object sender, DevExpress.XtraGrid.Views.Grid.PopupMenuShowingEventArgs e)
 {
     try
     {
         e.Menu.Items.Add(new DXMenuItem("Delete Current Row", (o1, e1) =>
         {
             VoucherGridView.DeleteRow(VoucherGridView.FocusedRowHandle);
             dt.AcceptChanges();
         }));
     }
     catch (Exception ex)
     {
         MessageBox_Debug.ShowBox(ex);
     }
 }