Example #1
0
        private void DataSave()
        {
            string ledgerID       = Guid.NewGuid().ToString();
            string bankName       = cmbBankName.Text.GetDBFormatString();
            string ledgerName     = txtLedgerName.Text.GetDBFormatString();
            string date           = dtpDate.Text;
            string headType       = cmbAcType.Text;
            string mSubAccount    = "Bank A/C";
            string mParentAccount = "Current Assets";
            string mAccountType   = "NULL";
            string query          = "";

            if (mLedgerId.ISNullOrWhiteSpace())
            {
                query = "Insert into LadgerMain(LadgerID, LadgerName, TemplateName, Category, SubAccount, ParentAccount, Type)" +
                        "values('" + ledgerID + "','" + bankName + "','" + ledgerName + "','Bank','" +
                        mSubAccount + "','" + mParentAccount + "'," + mAccountType + ")";
                mlistQuery.Add(query);
            }
            else
            {
                query = "Update LadgerMain set LadgerName='" + bankName + "', TemplateName='" +
                        ledgerName + "' where LadgerID='" + mLedgerId + "'";
                mlistQuery.Add(query);
            }
            string bankId     = ((KeyValuePair <string, string>)cmbBankName.SelectedItem).Key.ToString();
            string acno       = txtAcNo.Text;
            string ifsc       = txtIFSC.Text;
            string micr       = txtMICR.Text;
            string branchName = txtBranchName.Text.GetDBFormatString();
            string address    = txtAddress.Text.GetDBFormatString();
            string type       = cmbAcType.Text;

            if (mLedgerId.ISNullOrWhiteSpace())
            {
                query = "Insert into LedgerBankDetails(LedgerID, BankID, ACNo, IFSC, MICR, BranchName, " +
                        "Address, ACType) values('" + ledgerID + "','" + bankId + "','" + acno + "','" +
                        ifsc + "','" + micr + "','" + branchName + "','" + address + "','" + type + "')";
                mlistQuery.Add(query);
            }
            else
            {
                query = "Update LedgerBankDetails set BankID='" + bankId + "', ACNo='" + acno
                        + "', IFSC='" + ifsc + "', MICR='" + micr + "', BranchName='" + branchName
                        + "',Address='" + address + "', ACType='" + type + "' where LedgerID='" + mLedgerId + "'";
                mlistQuery.Add(query);
            }
            InsertIntoLedgerStatus(ledgerID);

            if (SQLHelper.GetInstance().ExecuteTransection(mlistQuery, out msg))
            {
                LedgerTools.GetBankLedgers();
                this.Close();
            }
            else
            {
                MessageBox.Show(msg + "\nData not save.", "Bank Account", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Example #2
0
        private void GetBillingDetails()
        {
            string ladgerId = ((KeyValuePair <string, string>)cmbSuppliersName.SelectedItem).Key.ToString();
            string mbillingName, mbillingAddress, mbillingSateName, mbillingStateCode, mbillingGSTNo;

            LedgerTools.GetLadgerBillingDetails(ladgerId, out mbillingName, out mbillingAddress, out mbillingSateName, out mbillingStateCode, out mbillingGSTNo);
            lblAddress.Text = mbillingAddress;
            lblState.Text   = mbillingSateName + " - " + mbillingSateName;
            lblGSTIN.Text   = mbillingGSTNo;
        }
Example #3
0
 private void FrmCreateCompany_onClose()
 {
     if (!LedgerTools.GetCashLedgers())
     {
         AddCashAccount frmAddCashAccount = new AddCashAccount();
         frmAddCashAccount.OnClose    += GenerateReport;
         frmAddCashAccount.WindowState = FormWindowState.Normal;
         frmAddCashAccount.ShowDialog();
     }
 }
        private void GetCustomerShippedDetails(string customerID)
        {
            string billingName = "", billingAddress = "", billingStateName = "", billingStateCOde = "", gstNo = "";

            LedgerTools.GetLadgerShippingDetails(customerID, out billingName, out billingAddress, out billingStateName, out billingStateCOde, out gstNo);

            lblShippedTo.Text      = billingName;
            lblShippedAddress.Text = billingAddress;
            lblShippedToGstin.Text = gstNo;

            lblStateCodeShipping.Text = billingStateCOde;
            lblStateNameShipping.Text = billingStateName;
        }
        private void DataSave()
        {
            string ledgerID      = Guid.NewGuid().ToString();
            string subAccount    = cmbSubAccount.Text.ToString();
            string templeteName  = txtAcName.Text.GetDBFormatString();
            string parentAccount = SubAccountTools.GetAccountParent(subAccount);
            string parentUnder   = SubAccountTools.GetAccountUnder(subAccount);

            parentUnder = parentUnder.ISNullOrWhiteSpace() ? "NULL" : "'" + parentUnder + "'";
            double amountBalance = 0d;

            double.TryParse(txtOpeningBalance.Text, out amountBalance);

            List <string> lstQuery = new List <string>();
            string        query    = "";

            if (mLedgerIdForUpdate.ISNullOrWhiteSpace())
            {
                query = "Insert into LadgerMain(LadgerID, LadgerName, TemplateName, Category, SubAccount, ParentAccount, Type)" +
                        "values('" + ledgerID + "','" + templeteName + "','" + templeteName + "','Others','" +
                        subAccount + "','" + parentAccount + "'," + parentUnder + ")";
                lstQuery.Add(query);
                query = "Insert into LedgerStatus( LedgerID, FinYearID, OpeningBalance, CurrentBalance) " +
                        "Values('" + ledgerID + "'," + FinancialYearTools._YearID + "," +
                        amountBalance + "," + amountBalance + ")";
                lstQuery.Add(query);
            }
            else
            {
                query = "Update LadgerMain set LadgerID='" + ledgerID + "',LadgerName='" + templeteName
                        + "',TemplateName='" + templeteName + "',SubAccount='" + subAccount
                        + "',ParentAccount='" + parentAccount + "',Type=" + parentUnder
                        + " where LadgerID='" + mLedgerIdForUpdate + "'";
                lstQuery.Add(query);
                query = "Update LedgerStatus set OpeningBalance=" + amountBalance + ", CurrentBalance=" +
                        amountBalance + " where LedgerID='" + ledgerID + "'," + FinancialYearTools._YearID + ",,)";
                lstQuery.Add(query);
            }
            if (SQLHelper.GetInstance().ExecuteTransection(lstQuery, out msg))
            {
                LedgerTools.GetOtherLedgers();
                mIsSuccess = true;
                this.Close();
            }
            else
            {
                MessageBox.Show(msg + "\nData not save", "Add Account", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
        private void GetCustomerAddressDetails(string customerID)
        {
            string billingName = "", billingAddress = "", billingStateName = "", billingStateCOde = "", gstNo = "";

            LedgerTools.GetLadgerBillingDetails(customerID, out billingName, out billingAddress, out billingStateName, out billingStateCOde, out gstNo);

            lblNameBilling.Text      = billingName;
            lblBillingAddress.Text   = billingAddress;
            lblGSTIn.Text            = gstNo;
            lblStateCodeBilling.Text = billingStateCOde;
            lblStateNameBilling.Text = billingStateName;

            mIsIGST = (ORG_Tools._StateCode == billingStateCOde) ? false : true;
            GenerateGridForNonGSTType();
        }
        public static void GetPaymentDetailsId(string transectionid)
        {
            string    query = " select LedgerIdFrom,LedgerIdTo,Mode, ChequeNo,BankName, ChequeDate from transection where TransectionID='" + transectionid + "'";
            DataTable dt    = SQLHelper.GetInstance().ExcuteNonQuery(query, out msg);

            if (dt.IsValidDataTable())
            {
                _PaymentMethod         = dt.Rows[0]["Mode"].ToString();
                _BankName              = dt.Rows[0]["BankName"].ToString();
                _ChequeDate            = dt.Rows[0]["ChequeDate"].ToString();
                _ChequeNo              = dt.Rows[0]["ChequeNo"].ToString();
                _DRAccountLedgerId     = dt.Rows[0]["LedgerIdFrom"].ToString();
                _CRAccountLedgerId     = dt.Rows[0]["LedgerIdTo"].ToString();
                _DRAccountTemplateName = LedgerTools.GetTempleteName(_DRAccountLedgerId);
                _CRAccountTemplateName = LedgerTools.GetTempleteName(_CRAccountLedgerId);
            }
        }
        private void DataSave()
        {
            string slNo         = lblJurnalNo.Text;
            string date         = dtpDate.Text;
            string cashLedgerID = ((KeyValuePair <string, string>)cmbCashLedger.SelectedItem).Key.ToString();
            double amount       = 0d;

            double.TryParse(txtAmount.Text, out amount);
            string chequeNo        = txtChequeNo.Text.GetDBFormatString();
            string chequeDate      = dtpDateCheque.Text;
            string transectionType = mMode.ToString();
            string transectionMode = "";
            string narration       = txtDescription.Text.GetDBFormatString();
            string drLedgerid      = mLedgerID;
            string crLedgerid      = cashLedgerID;
            string mquery          = "";

            switch (mMode)
            {
            case _Mode.Deposit:
                InsertOrUpdateTransection(date, slNo, amount, drLedgerid, crLedgerid, transectionType, chequeNo, chequeDate, transectionMode, narration);
                #region UpdateLedgerStatus
                if (!mSlNoEdit.ISNullOrWhiteSpace())
                {
                    #region CurrentBalanceRestore

                    mLstQuery.Add(LedgerStatus.UpdateLedgerStatus(TransectionTools._CRAccountLedgerId, TransectionTools._DRAccountLedgerId, mTotalPreviousAmount.ToString("0.00"), out mquery));    //drQuery Add in the ListQuery and Out CrQuery in mQuery
                    mLstQuery.Add(mquery);
                    #endregion
                }
                #region CurrentBalanceUpdate

                mLstQuery.Add(LedgerStatus.UpdateLedgerStatus(drLedgerid, crLedgerid, amount.ToString("0.00"), out mquery));    //drQuery Add in the ListQuery and Out CrQuery in mQuery
                mLstQuery.Add(mquery);
                #endregion

                #endregion
                break;

            case _Mode.Withdrawal:
                transectionMode = "Cheque";
                drLedgerid      = cashLedgerID;
                crLedgerid      = mLedgerID;

                InsertOrUpdateTransection(date, slNo, amount, drLedgerid, crLedgerid, transectionType, chequeNo, chequeDate, transectionMode, narration);
                #region UpdateLedgerStatus
                if (!mSlNoEdit.ISNullOrWhiteSpace())
                {
                    #region CurrentBalanceRestore

                    mLstQuery.Add(LedgerStatus.UpdateLedgerStatus(TransectionTools._CRAccountLedgerId, TransectionTools._DRAccountLedgerId, mTotalPreviousAmount.ToString("0.00"), out mquery));    //drQuery Add in the ListQuery and Out CrQuery in mQuery
                    mLstQuery.Add(mquery);
                    #endregion
                }
                #region CurrentBalanceUpdate

                mLstQuery.Add(LedgerStatus.UpdateLedgerStatus(drLedgerid, crLedgerid, amount.ToString("0.00"), out mquery));    //drQuery Add in the ListQuery and Out CrQuery in mQuery
                mLstQuery.Add(mquery);
                #endregion

                #endregion
                break;

            default:
                break;
            }
            if (SQLHelper.GetInstance().ExecuteTransection(mLstQuery, out msg))
            {
                LedgerTools.GetBankLedgers();
                mSuccess = true;
                this.Close();
            }
            else
            {
                MessageBox.Show(msg, mMode.ToString(), MessageBoxButtons.OK, MessageBoxIcon.Stop);
            }
        }