Esempio n. 1
0
        private void ECashReceiptVoucherForm_SetupControl()
        {
            LoadInvoices();
            ShowAmountToApply();
            DisplaySummary();

            //load journal entry
            if (FormState == FormStates.fsView)
            {
                if (!dstJournalEntry.ZLoadGrid)
                {
                    dstJournalEntry.ZLoadGrid = true;
                }

                dstJournalEntry.Parameters[0].Value          = this.MasterColumns.Find(mc => mc.Name == "JournalId").Value.ToString();
                dstJournalEntry.DataTable                    = VTransactionHandler.LoadData(dstJournalEntry.CommandText, dstJournalEntry.Parameters);
                dataGridViewJournalEntry.DataSource          = dstJournalEntry.DataTable;
                dataGridViewJournalEntry.AutoGenerateColumns = false;

                tabPageJournalEntry.Text = String.Format("Journal Entry ({0})", dstJournalEntry.DataTable.Rows[0]["TransactionNo"].ToString());

                if (!tabControlDetails.TabPages.Contains(tabPageJournalEntry))
                {
                    tabControlDetails.TabPages.Insert(1, tabPageJournalEntry);
                }
            }
            else
            {
                tabPageJournalEntry.Text = "Journal Entry";
                tabControlDetails.TabPages.Remove(tabPageJournalEntry);
            }
        }
        protected virtual void OnSetupData()
        {
            //load all lookups
            foreach (JkLookUpComboBox comboBox in IAppHandler.FindControlByType("JkLookUpComboBox", this))
            {
                comboBox.LoadData();
            }

            //clear all datatables
            VMasterDataTable.Clear();
            foreach (JkDetailDataSet DataSet in IAppHandler.FindControlByType("JkDetailDataSet", this))
            {
                DataSet.DataTable.Clear();
            }

            if (CommandText != null && CommandText != "")
            {
                VTransactionHandler.LoadData(CommandText, ref VMasterDataTable, this.Parameters);
            }

            if (SetupData != null)
            {
                SetupData();
            }
        }
        private void IMasterDetailForm_SetupData()
        {
            foreach (JkDetailDataSet DataSet in IAppHandler.FindControlByType("JkDetailDataSet", this))
            {
                if (!String.IsNullOrWhiteSpace(DataSet.CommandText) && DataSet.LinkToMaster)
                {
                    DataSet.Parameters.Find(dp => dp.Name == "Id").Value = Parameters.Find(p => p.Name == "Id").Value;
                    if (!String.IsNullOrWhiteSpace(DataSet.CommandText))
                    {
                        DataSet.DataTable = VTransactionHandler.LoadData(DataSet.CommandText, DataSet.Parameters);
                        DataSet.AddTemporaryColumns();
                        DataSet.GridView.DataSource = DataSet.DataTable;
                    }

                    //For further update on this code, I'm still not sure if this will fit on all scenarios
                    foreach (DataColumn column in DataSet.DataTable.Columns)
                    {
                        if (!column.AllowDBNull && column.DataType.ToString() == "System.Int32" && !column.AutoIncrement)
                        {
                            if (FormState == FormStates.fsNew)
                            {
                                column.DefaultValue = -1;
                            }
                            else
                            {
                                column.DefaultValue = Parameters.Find(p => p.Name == "Id").Value;
                            }
                        }
                    }
                }

                //load data from lookup to grid
                foreach (DataGridViewColumn column in DataSet.GridView.Columns)
                {
                    if (column.GetType().ToString().Contains("DataGridViewComboBoxColumn"))
                    {
                        DataGridViewComboBoxColumn comboBox = column as DataGridViewComboBoxColumn;
                        JkLookUpComboBox           lookUp   = (Controls.Find(DataSet.Columns.Find(dc => dc.Name == column.DataPropertyName).ControlName, true).First() as JkLookUpComboBox);

                        if (lookUp.Items.Count == 0)
                        {
                            lookUp.LoadData();
                        }

                        comboBox.DataSource    = lookUp.DataSource;
                        comboBox.DisplayMember = lookUp.DisplayText;
                        comboBox.ValueMember   = lookUp.Key;
                    }
                }
            }
        }
        private void EBillsPaymentForm_SetupControl()
        {
            dataGridView.AllowUserToAddRows = false;

            foreach (ToolStripMenuItem item in btnPreview.DropDown.Items)
            {
                if (item.Text == "Check")
                {
                    item.Enabled = HasCheck();
                }

                if (item.Text == "BIR Form 2307")
                {
                    item.Enabled = Print2307();
                }
            }

            ShowAmountToApply();

            //load journal entry
            if (FormState == FormStates.fsView)
            {
                if (!dstJournalEntry.ZLoadGrid)
                {
                    dstJournalEntry.ZLoadGrid = true;
                }

                dstJournalEntry.Parameters[0].Value          = this.MasterColumns.Find(mc => mc.Name == "JournalId").Value.ToString();
                dstJournalEntry.DataTable                    = VTransactionHandler.LoadData(dstJournalEntry.CommandText, dstJournalEntry.Parameters);
                dataGridViewJournalEntry.DataSource          = dstJournalEntry.DataTable;
                dataGridViewJournalEntry.AutoGenerateColumns = false;

                tabPageJournalEntry.Text = String.Format("Journal Entry ({0})", dstJournalEntry.DataTable.Rows[0]["TransactionNo"].ToString());

                if (!tabControlDetails.TabPages.Contains(tabPageJournalEntry))
                {
                    tabControlDetails.TabPages.Insert(1, tabPageJournalEntry);
                }
            }
            else
            {
                tabPageJournalEntry.Text = "Journal Entry";
                tabControlDetails.TabPages.Remove(tabPageJournalEntry);
            }
        }
Esempio n. 5
0
        private void EBillsForm_SetupControl()
        {
            txtGrossAmount.Text    = double.Parse(txtGrossAmount.Text).ToString("#,##0.00;(#,##0.00)");
            txtWTAX.Text           = double.Parse(txtWTAX.Text).ToString("#,##0.00;(#,##0.00)");
            txtVATAmount.Text      = double.Parse(txtVATAmount.Text).ToString("#,##0.00;(#,##0.00)");
            txtDiscountAmount.Text = double.Parse(txtDiscountAmount.Text).ToString("#,##0.00;(#,##0.00)");
            txtNetAmount.Text      = double.Parse(txtNetAmount.Text).ToString("#,##0.00;(#,##0.00)");
            txtPaidAmount.Text     = double.Parse(txtPaidAmount.Text).ToString("#,##0.00;(#,##0.00)");
            txtBalance.Text        = (double.Parse(txtNetAmount.Text) - double.Parse(txtPaidAmount.Text)).ToString("#,##0.00;(#,##0.00)");

            //load journal entry
            if (FormState == FormStates.fsView)
            {
                if (!dstJournalEntry.ZLoadGrid)
                {
                    dstJournalEntry.ZLoadGrid = true;
                }

                dstJournalEntry.Parameters[0].Value = this.MasterColumns.Find(mc => mc.Name == "JournalId").Value.ToString();
                dstJournalEntry.DataTable           = VTransactionHandler.LoadData(dstJournalEntry.CommandText, dstJournalEntry.Parameters);
                if (dataGridViewJournalEntry.DataSource == null)
                {
                    dataGridViewJournalEntry.DataSource          = dstJournalEntry.DataTable;
                    dataGridViewJournalEntry.AutoGenerateColumns = false;
                }

                tabPageJournalEntry.Text = String.Format("Journal Entry ({0})", dstJournalEntry.DataTable.Rows[0]["TransactionNo"].ToString());

                if (!tabControlDetails.TabPages.Contains(tabPageJournalEntry))
                {
                    tabControlDetails.TabPages.Insert(1, tabPageJournalEntry);
                }
            }
            else
            {
                tabPageJournalEntry.Text = "Journal Entry";
                tabControlDetails.TabPages.Remove(tabPageJournalEntry);
            }
        }
Esempio n. 6
0
        private String GetIdentifierHeader()
        {
            DataTable table = new DataTable();
            String    CommandText, result;
            List <JkFormParameter> param = new List <JkFormParameter>();

            CommandText = "SELECT IdentifierColumnName FROM tblSystemLogTableConfig WHERE Caption = @Caption";
            param.Add(new JkFormParameter()
            {
                Value = this.SubCategory, Name = "Caption"
            });
            table  = VTransactionHandler.LoadData(CommandText, param);
            result = table.Rows[table.Rows.Count - 1][0].ToString();

            if (result == "TransactionNo")
            {
                result = "Transaction No";
            }

            table.Dispose();

            return(result);
        }