///Child Form Close Events
        ///
        private void FormTransactionBook_FormClosed(object sender, FormClosedEventArgs e)
        {
            try
            {
                ExtensionMethods.RemoveChildFormToPanel(this, (Control)sender, ExtensionMethods.MainPanel);
                AccountLedgerMaster lastSelectedTransactionBook = (sender as frmAccountLedgerMaster).LastSelectedAccountLedger;

                if (lastSelectedTransactionBook != null)
                {
                    if (lastSelectedTransactionBook.AccountLedgerID > 0)
                    {
                        txtTransactAccount.Text = lastSelectedTransactionBook.AccountLedgerName;
                        txtTransactAccount.Tag  = lastSelectedTransactionBook.AccountLedgerCode;
                        dgvReceiptFromCustomer.Focus();
                    }

                    if (dgvReceiptFromCustomer.Rows.Count == 0)
                    {
                        AddNewRowToGrid();
                    }

                    dgvReceiptFromCustomer.CurrentCell = dgvReceiptFromCustomer.Rows[0].Cells["LedgerTypeCode"];
                    dgvReceiptFromCustomer.BeginEdit(true);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
        public int AddAccountLedger(PharmaBusinessObjects.Master.AccountLedgerMaster p)
        {
            using (PharmaDBEntities context = new PharmaDBEntities())
            {
                var maxAccountLedgerID = context.AccountLedgerMaster.Count() > 0 ? context.AccountLedgerMaster.Max(q => q.AccountLedgerID) + 1 : 1;

                var accountLedgerCode = "L" + maxAccountLedgerID.ToString().PadLeft(6, '0');

                AccountLedgerMaster table = new AccountLedgerMaster()
                {
                    AccountLedgerName   = p.AccountLedgerName,
                    AccountLedgerCode   = accountLedgerCode,
                    AccountLedgerTypeId = p.AccountLedgerTypeId,
                    AccountTypeId       = p.AccountTypeId,
                    OpeningBalance      = p.OpeningBalance,
                    CreditDebit         = p.CreditDebit,
                    SalePurchaseTaxType = p.SalePurchaseTaxValue,
                    Status    = p.Status,
                    CreatedBy = this.LoggedInUser.Username,
                    CreatedOn = System.DateTime.Now
                };

                var accountLedger = new Common.CommonDao().GetAccountLedgerTypes().Where(q => q.AccountLedgerTypeID == p.AccountLedgerTypeId).FirstOrDefault();

                if (accountLedger.AccountLedgerTypeSystemName != Constants.AccountLedgerType.ControlCodes)
                {
                    table.CreditControlCodeID = p.CreditControlCodeID;
                    table.DebitControlCodeID  = p.DebitControlCodeID;
                }

                context.AccountLedgerMaster.Add(table);
                return(context.SaveChanges());
            }
        }
Beispiel #3
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                if (string.IsNullOrEmpty(tbAccountName.Text))
                {
                    MessageBox.Show("Account Name can not be blank");
                    tbAccountName.Focus();
                    return;
                }

                if (string.IsNullOrEmpty(tbOpeningBalance.Text))
                {
                    MessageBox.Show("Account Name can not be blank");
                    tbOpeningBalance.Focus();
                    return;
                }

                Status status;

                AccountLedgerMaster model = new AccountLedgerMaster();
                model.AccountLedgerTypeId  = (int)cbAccountLedgerType.SelectedValue;
                model.AccountLedgerName    = tbAccountName.Text;
                model.AccountTypeId        = (int)cbAccountType.SelectedValue;
                model.OpeningBalance       = (decimal)ExtensionMethods.SafeConversionDecimal(tbOpeningBalance.Text);
                model.CreditDebit          = cbDebitCredit.Text;
                model.AccountLedgerCode    = txtAccountLedgerCode.Text;
                model.SalePurchaseTaxValue = ExtensionMethods.SafeConversionDecimal(txtSalePurchaseValue.Text);

                if (cbDebitControlCode.DataSource != null)
                {
                    model.DebitControlCodeID  = (int)cbDebitControlCode.SelectedValue;
                    model.CreditControlCodeID = (int)cbCreditControlCode.SelectedValue;
                }
                model.AccountLedgerID = this.AccountLedgerId;

                Enum.TryParse <Status>(cbxStatus.SelectedValue.ToString(), out status);
                model.Status = status == Status.Active;

                var result = this.AccountLedgerId > 0 ? applicationFacade.UpdateAccountLedger(model) : applicationFacade.AddAccountLedger(model);

                if (result > 0)
                {
                    this.Close();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
        private void StartMigration()
        {
            CompanyMaster        companyMaster        = new CompanyMaster();
            ItemMaster           itemMaster           = new ItemMaster();
            PersonRouteMaster    personRouteMaster    = new PersonRouteMaster();
            PersonalLedgerMaster personalLedgerMaster = new PersonalLedgerMaster();
            AccountLedgerMaster  accountLedgerMaster  = new AccountLedgerMaster();
            SupplierLedgerMaster supplierLedgerMaster = new SupplierLedgerMaster();
            CustomerLedgerMaster customerLedgerMaster = new CustomerLedgerMaster();
            BillOutstanding      billOutstanding      = new BillOutstanding();
            FIFO fifo = new FIFO();

            int result;

            grdDataMigration.Rows.Add("Company Master", "Processing", 0);
            result = 0;

            result = companyMaster.InsertCompanyMasterData();

            grdDataMigration.Rows[0].Cells[1].Value = "Completed";
            grdDataMigration.Rows[0].Cells[2].Value = result;

            grdDataMigration.Rows.Add("A.S.M.", "Processing", 0);
            result = 0;

            result = personRouteMaster.InsertASMData();

            grdDataMigration.Rows[1].Cells[1].Value = "Completed";
            grdDataMigration.Rows[1].Cells[2].Value = result;

            grdDataMigration.Rows.Add("R.S.M.", "Processing", 0);
            result = 0;

            result = personRouteMaster.InsertRSMData();

            grdDataMigration.Rows[2].Cells[1].Value = "Completed";
            grdDataMigration.Rows[2].Cells[2].Value = result;

            grdDataMigration.Rows.Add("Z.S.M.", "Processing", 0);
            result = 0;

            result = personRouteMaster.InsertZSMData();

            grdDataMigration.Rows[3].Cells[1].Value = "Completed";
            grdDataMigration.Rows[3].Cells[2].Value = result;

            grdDataMigration.Rows.Add("Sales Man", "Processing", 0);
            result = 0;

            result = personRouteMaster.InsertSalesManData();

            grdDataMigration.Rows[4].Cells[1].Value = "Completed";
            grdDataMigration.Rows[4].Cells[2].Value = result;

            grdDataMigration.Rows.Add("Area", "Processing", 0);
            result = 0;

            result = personRouteMaster.InsertAreaData();

            grdDataMigration.Rows[5].Cells[1].Value = "Completed";
            grdDataMigration.Rows[5].Cells[2].Value = result;

            grdDataMigration.Rows.Add("Route", "Processing", 0);
            result = 0;

            result = personRouteMaster.InsertRouteData();

            grdDataMigration.Rows[6].Cells[1].Value = "Completed";
            grdDataMigration.Rows[6].Cells[2].Value = result;

            grdDataMigration.Rows.Add("Personal Details", "Processing", 0);
            result = 0;

            result = personalLedgerMaster.InsertPersonalLedgerMasterData();

            grdDataMigration.Rows[7].Cells[1].Value = "Completed";
            grdDataMigration.Rows[7].Cells[2].Value = result;

            grdDataMigration.Rows.Add("Control Codes", "Processing", 0);
            result = 0;

            result = accountLedgerMaster.InsertControlCodesData();

            grdDataMigration.Rows[8].Cells[1].Value = "Completed";
            grdDataMigration.Rows[8].Cells[2].Value = result;

            grdDataMigration.Rows.Add("Income Ledger", "Processing", 0);
            result = 0;

            result = accountLedgerMaster.InsertIncomeLedgerData();

            grdDataMigration.Rows[9].Cells[1].Value = "Completed";
            grdDataMigration.Rows[9].Cells[2].Value = result;

            grdDataMigration.Rows.Add("Expenditure Ledger", "Processing", 0);
            result = 0;

            result = accountLedgerMaster.InsertExpenditureLedgerData();

            grdDataMigration.Rows[10].Cells[1].Value = "Completed";
            grdDataMigration.Rows[10].Cells[2].Value = result;

            grdDataMigration.Rows.Add("Transaction Books", "Processing", 0);
            result = 0;

            result = accountLedgerMaster.InsertTransactionLedgerData();

            grdDataMigration.Rows[11].Cells[1].Value = "Completed";
            grdDataMigration.Rows[11].Cells[2].Value = result;

            grdDataMigration.Rows.Add("General Ledger", "Processing", 0);
            result = 0;

            result = accountLedgerMaster.InsertGeneralLedgerData();

            grdDataMigration.Rows[12].Cells[1].Value = "Completed";
            grdDataMigration.Rows[12].Cells[2].Value = result;

            grdDataMigration.Rows.Add("Purchase Ledger", "Processing", 0);
            result = 0;

            result = accountLedgerMaster.InsertPurchaseLedgerData();

            grdDataMigration.Rows[13].Cells[1].Value = "Completed";
            grdDataMigration.Rows[13].Cells[2].Value = result;

            grdDataMigration.Rows.Add("Sale Ledger", "Processing", 0);
            result = 0;

            result = accountLedgerMaster.InsertSaleLedgerData();

            grdDataMigration.Rows[14].Cells[1].Value = "Completed";
            grdDataMigration.Rows[14].Cells[2].Value = result;

            grdDataMigration.Rows.Add("Item Master", "Processing", 0);
            result = 0;

            result = itemMaster.InsertItemMasterData();

            grdDataMigration.Rows[15].Cells[1].Value = "Completed";
            grdDataMigration.Rows[15].Cells[2].Value = result;

            grdDataMigration.Rows.Add("FIFO", "Processing", 0);
            result = 0;

            result = fifo.InsertFIFOData();

            grdDataMigration.Rows[16].Cells[1].Value = "Completed";
            grdDataMigration.Rows[16].Cells[2].Value = result;


            grdDataMigration.Rows.Add("Supplier Ledger", "Processing", 0);
            result = 0;

            result = supplierLedgerMaster.InsertSupplierLedgerMasterData();

            grdDataMigration.Rows[17].Cells[1].Value = "Completed";
            grdDataMigration.Rows[17].Cells[2].Value = result;

            grdDataMigration.Rows.Add("Customer Ledger", "Processing", 0);
            result = 0;

            result = customerLedgerMaster.InsertCustomerLedgerMasterData(); //confirm mapping columns for columns having comments in CustomerLedgerMaster

            grdDataMigration.Rows[18].Cells[1].Value = "Completed";
            grdDataMigration.Rows[18].Cells[2].Value = result;

            //For below method check comments in CustomerLedgerMaster
            grdDataMigration.Rows.Add("Customer Company Discount", "Processing", 0);
            result = 0;

            result = customerLedgerMaster.InsertCustomerCompanyReferenceData();

            grdDataMigration.Rows[19].Cells[1].Value = "Completed";
            grdDataMigration.Rows[19].Cells[2].Value = result;


            //For below method check comments in CustomerLedgerMaster
            grdDataMigration.Rows.Add("Supplier Company Discount", "Processing", 0);
            result = 0;

            result = supplierLedgerMaster.InsertSupplierCompanyReferenceData();

            grdDataMigration.Rows[20].Cells[1].Value = "Completed";
            grdDataMigration.Rows[20].Cells[2].Value = result;

            grdDataMigration.Rows.Add("Bill Oustanding", "Processing", 0);
            result = 0;

            result = billOutstanding.InsertBillOutstandingData();

            grdDataMigration.Rows[21].Cells[1].Value = "Completed";
            grdDataMigration.Rows[21].Cells[2].Value = result;


            MessageBox.Show("Process Completed");
        }
Beispiel #5
0
        private void StartMigration()
        {
            CompanyMaster        companyMaster        = new CompanyMaster();
            ItemMaster           itemMaster           = new ItemMaster();
            PersonRouteMaster    personRouteMaster    = new PersonRouteMaster();
            PersonalLedgerMaster personalLedgerMaster = new PersonalLedgerMaster();
            AccountLedgerMaster  accountLedgerMaster  = new AccountLedgerMaster();
            SupplierLedgerMaster supplierLedgerMaster = new SupplierLedgerMaster();
            CustomerLedgerMaster customerLedgerMaster = new CustomerLedgerMaster();
            BillOutstanding      billOutstanding      = new BillOutstanding();
            FIFO fifo = new FIFO();
            PurchaseSaleBookHeaderMigration   purchaseSaleBookHeaderMigration   = new PurchaseSaleBookHeaderMigration();
            PurchaseSaleBookLineItemMigration purchaseSaleBookLineItemMigration = new PurchaseSaleBookLineItemMigration();
            TRN trn = new TRN();
            ReceiptPaymentMigration receiptPayment = new ReceiptPaymentMigration();
            BillOutStandingsAudjustmentMigration billOsAdjustment = new BillOutStandingsAudjustmentMigration();


            int result   = 0;
            int rowIndex = 0;

            SetProcessingText(grdDataMigration, "Company Master", rowIndex, "Processing", result, true);
            result = companyMaster.InsertCompanyMasterData();
            SetProcessingText(grdDataMigration, "Company Master", rowIndex, "Completed", result, false);

            result    = 0;
            rowIndex += 1;
            SetProcessingText(grdDataMigration, "ASM", rowIndex, "Processing", result, true);
            result = personRouteMaster.InsertASMData();
            SetProcessingText(grdDataMigration, "ASM", rowIndex, "Completed", result, false);

            result    = 0;
            rowIndex += 1;
            SetProcessingText(grdDataMigration, "RSM", rowIndex, "Processing", result, true);
            result = personRouteMaster.InsertRSMData();
            SetProcessingText(grdDataMigration, "RSM", rowIndex, "Completed", result, false);

            result    = 0;
            rowIndex += 1;
            SetProcessingText(grdDataMigration, "ZSM", rowIndex, "Processing", result, true);
            result = personRouteMaster.InsertZSMData();
            SetProcessingText(grdDataMigration, "ZSM", rowIndex, "Completed", result, false);

            result    = 0;
            rowIndex += 1;
            SetProcessingText(grdDataMigration, "Sales Man", rowIndex, "Processing", result, true);
            result = personRouteMaster.InsertSalesManData();
            SetProcessingText(grdDataMigration, "Sales Man", rowIndex, "Completed", result, false);

            result    = 0;
            rowIndex += 1;
            SetProcessingText(grdDataMigration, "Area", rowIndex, "Processing", result, true);
            result = personRouteMaster.InsertAreaData();
            SetProcessingText(grdDataMigration, "Area", rowIndex, "Completed", result, false);

            result    = 0;
            rowIndex += 1;
            SetProcessingText(grdDataMigration, "Route", rowIndex, "Processing", result, true);
            result = personRouteMaster.InsertRouteData();
            SetProcessingText(grdDataMigration, "Route", rowIndex, "Completed", result, false);

            result    = 0;
            rowIndex += 1;
            SetProcessingText(grdDataMigration, "Personal Ledger", rowIndex, "Processing", result, true);
            result = personalLedgerMaster.InsertPersonalLedgerMasterData();
            SetProcessingText(grdDataMigration, "Personal Ledger", rowIndex, "Completed", result, false);

            result    = 0;
            rowIndex += 1;
            SetProcessingText(grdDataMigration, "Control Codes", rowIndex, "Processing", result, true);
            result = accountLedgerMaster.InsertControlCodesData();
            SetProcessingText(grdDataMigration, "Control Codes", rowIndex, "Completed", result, false);

            result    = 0;
            rowIndex += 1;
            SetProcessingText(grdDataMigration, "Income Ledger", rowIndex, "Processing", result, true);
            result = accountLedgerMaster.InsertIncomeLedgerData();
            SetProcessingText(grdDataMigration, "Income Ledger", rowIndex, "Completed", result, false);

            result    = 0;
            rowIndex += 1;
            SetProcessingText(grdDataMigration, "Expenditure Ledger", rowIndex, "Processing", result, true);
            result = accountLedgerMaster.InsertExpenditureLedgerData();
            SetProcessingText(grdDataMigration, "Expenditure Ledger", rowIndex, "Completed", result, false);

            result    = 0;
            rowIndex += 1;
            SetProcessingText(grdDataMigration, "Transaction Ledger", rowIndex, "Processing", result, true);
            result = accountLedgerMaster.InsertTransactionLedgerData();
            SetProcessingText(grdDataMigration, "Transaction Ledger", rowIndex, "Completed", result, false);

            result    = 0;
            rowIndex += 1;
            SetProcessingText(grdDataMigration, "General Ledger", rowIndex, "Processing", result, true);
            result = accountLedgerMaster.InsertGeneralLedgerData();
            SetProcessingText(grdDataMigration, "General Ledger", rowIndex, "Completed", result, false);

            result    = 0;
            rowIndex += 1;
            SetProcessingText(grdDataMigration, "Purchase Ledger", rowIndex, "Processing", result, true);
            result = accountLedgerMaster.InsertPurchaseLedgerData();
            SetProcessingText(grdDataMigration, "Purchase Ledger", rowIndex, "Completed", result, false);

            result    = 0;
            rowIndex += 1;
            SetProcessingText(grdDataMigration, "Sale Ledger", rowIndex, "Processing", result, true);
            result = accountLedgerMaster.InsertSaleLedgerData();
            SetProcessingText(grdDataMigration, "Sale Ledger", rowIndex, "Completed", result, false);

            result    = 0;
            rowIndex += 1;
            SetProcessingText(grdDataMigration, "Item Master", rowIndex, "Processing", result, true);
            result = itemMaster.InsertItemMasterData();
            SetProcessingText(grdDataMigration, "Item Master", rowIndex, "Completed", result, false);

            result    = 0;
            rowIndex += 1;
            SetProcessingText(grdDataMigration, "Supplier Ledger", rowIndex, "Processing", result, true);
            result = supplierLedgerMaster.InsertSupplierLedgerMasterData();
            SetProcessingText(grdDataMigration, "Supplier Ledger", rowIndex, "Completed", result, false);

            result    = 0;
            rowIndex += 1;
            SetProcessingText(grdDataMigration, "Customer Ledger", rowIndex, "Processing", result, true);
            result = customerLedgerMaster.InsertCustomerLedgerMasterData(); //confirm mapping columns for columns having comments in CustomerLedgerMaster
            SetProcessingText(grdDataMigration, "Customer Ledger", rowIndex, "Completed", result, false);

            //result = 0;
            //rowIndex += 1;
            //SetProcessingText(grdDataMigration, "Customer Compnay Discount Ref", rowIndex, "Processing", result, true);
            //result = customerLedgerMaster.InsertCustomerCompanyReferenceData();
            //SetProcessingText(grdDataMigration, "Customer Compnay Discount Ref", rowIndex, "Completed", result, false);

            //result = 0;
            //rowIndex += 1;
            //SetProcessingText(grdDataMigration, "Suppiier Compnay Discount Ref", rowIndex, "Processing", result, true);
            //result = supplierLedgerMaster.InsertSupplierCompanyReferenceData();
            //SetProcessingText(grdDataMigration, "Suppiier Compnay Discount Ref", rowIndex, "Completed", result, false);

            /*------------------------------------------------------------*/

            result    = 0;
            rowIndex += 1;
            SetProcessingText(grdDataMigration, "PurchaseSaleBookHeaderData", rowIndex, "Processing", result, true);
            result = purchaseSaleBookHeaderMigration.InsertPurchaseSaleBookHeaderData();
            SetProcessingText(grdDataMigration, "PurchaseSaleBookHeaderData", rowIndex, "Completed", result, false);

            result    = 0;
            rowIndex += 1;
            SetProcessingText(grdDataMigration, "PurchaseSaleBookLineItemData", rowIndex, "Processing", result, true);
            result = purchaseSaleBookLineItemMigration.InsertPurchaseSaleBookLineItemData();
            SetProcessingText(grdDataMigration, "PurchaseSaleBookLineItemData", rowIndex, "Completed", result, false);

            result    = 0;
            rowIndex += 1;
            SetProcessingText(grdDataMigration, "Fifo", rowIndex, "Processing", result, true);
            result = fifo.InsertFIFOData();
            SetProcessingText(grdDataMigration, "Fifo", rowIndex, "Completed", result, false);

            result    = 0;
            rowIndex += 1;
            SetProcessingText(grdDataMigration, "Bill Outstanding", rowIndex, "Processing", result, true);
            result = billOutstanding.InsertBillOutstandingData();
            SetProcessingText(grdDataMigration, "Bill Outstanding", rowIndex, "Completed", result, false);


            result    = 0;
            rowIndex += 1;
            SetProcessingText(grdDataMigration, "TRN", rowIndex, "Processing", result, true);
            trn.InsertTRNData();
            SetProcessingText(grdDataMigration, "TRN", rowIndex, "Completed", 0, false);

            result    = 0;
            rowIndex += 1;
            SetProcessingText(grdDataMigration, "ReceiptPayment", rowIndex, "Processing", result, true);
            result = receiptPayment.InsertReceiptPaymentData();
            SetProcessingText(grdDataMigration, "ReceiptPayment", rowIndex, "Completed", 0, false);

            result    = 0;
            rowIndex += 1;
            SetProcessingText(grdDataMigration, "BillOutStandingsAudjustment", rowIndex, "Processing", result, true);
            result = billOsAdjustment.InsertBillOutStandingsAudjustmentData();
            SetProcessingText(grdDataMigration, "BillOutStandingsAudjustment", rowIndex, "Completed", 0, false);

            /* ---------------------------------------  ---------------------------------------*/

            MessageBox.Show("Process Completed");
        }