Exemplo n.º 1
0
        public decimal GetLedgerBalance(DAL.Ledger l)
        {
            decimal OPDr = 0, OPCr = 0, Dr = 0, Cr = 0;

            LedgerBalance(l, DateTime.Now, DateTime.Now, ref OPDr, ref OPCr, ref Dr, ref Cr);
            return(Dr + Cr);
        }
Exemplo n.º 2
0
        public int Ledger_Save(BLL.Ledger led)
        {
            try
            {
                DAL.Ledger d = DB.Ledgers.Where(x => x.Id == led.Id).FirstOrDefault();
                if (d == null)
                {
                    d = new DAL.Ledger();
                    DB.Ledgers.Add(d);

                    led.toCopy <DAL.Ledger>(d);

                    DB.SaveChanges();
                    led.Id = d.Id;

                    LogDetailStore(led, LogDetailType.INSERT);
                }
                else
                {
                    led.toCopy <DAL.Ledger>(d);
                    DB.SaveChanges();
                    LogDetailStore(led, LogDetailType.UPDATE);
                }

                Clients.Clients(OtherLoginClientsOnGroup).Ledger_Save(led);

                return(led.Id = d.Id);
            }
            catch (Exception ex) { }
            return(0);
        }
        private void frmPurchaseNew_Load(object sender, EventArgs e)
        {
            //loading ComboBox
            DAL.Ledger   ld = new DAL.Ledger();
            DAL.Employee em = new DAL.Employee();
            DAL.Product  p  = new DAL.Product();
            DAL.Purchase pr = new DAL.Purchase();

            cmbLedger.DataSource    = ld.select().Tables[0];
            cmbLedger.DisplayMember = "name";
            cmbLedger.ValueMember   = "id";
            cmbLedger.SelectedValue = -1;

            cmbEmployee.DataSource    = em.select().Tables[0];
            cmbEmployee.DisplayMember = "name";
            cmbEmployee.ValueMember   = "id";
            cmbEmployee.SelectedValue = -1;

            //product
            colProduct.DataSource    = p.select().Tables[0];
            colProduct.DisplayMember = "name";
            colProduct.ValueMember   = "id";

            this.MaximumSize = this.Size;
            this.MinimumSize = this.Size;
        }
Exemplo n.º 4
0
        public decimal GetLedgerBalance_NoOP(DAL.Ledger l, DateTime dt)
        {
            decimal OPDr = 0, OPCr = 0, Dr = 0, Cr = 0;

            LedgerBalance(l, dt, dt, ref OPDr, ref OPCr, ref Dr, ref Cr);
            return(Dr + Cr);
        }
Exemplo n.º 5
0
        private void btnDelete_Click(object sender, EventArgs e)
        {
            if (dgvLedger.SelectedRows.Count <= 0)
            {
                return;
            }

            DialogResult dr = MessageBox.Show("Are you sure ?", "Confirmation", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question);

            if (dr != DialogResult.Yes)
            {
                return;
            }

            DAL.Ledger ld = new DAL.Ledger();
            ld.Id = Convert.ToInt32(dgvLedger.SelectedRows[0].Cells["colId"].Value);
            if (ld.delete())
            {
                MessageBox.Show("Data has been Deleted");
                btnSearch.PerformClick();
            }
            else
            {
                MessageBox.Show(ld.Error);
            }
        }
Exemplo n.º 6
0
        public bool Ledger_CanDelete(DAL.Ledger l)
        {
            bool rv = (l == null) ? false : l.Payments.Count() == 0 &&
                      l.PaymentDetails.Count() == 0 &&
                      l.Receipts.Count() == 0 &&
                      l.ReceiptDetails.Count() == 0 &&
                      l.JournalDetails.Count() == 0;

            return(rv);
        }
Exemplo n.º 7
0
        void LedgerBalance(DAL.Ledger l, DateTime dtFrom, DateTime dtTo, ref decimal OPDr, ref decimal OPCr, ref decimal Dr, ref decimal Cr)
        {
            decimal PDr, PCr, RDr, RCr, JDr, JCr;

            OPDr = l.OPDr ?? 0;
            OPCr = l.OPCr ?? 0;

            PDr = l.PaymentDetails.Where(x => x.Payment.PaymentDate < dtFrom).Sum(x => x.Amount);
            PCr = l.Payments.Where(x => x.PaymentDate < dtFrom).Sum(x => x.Amount);

            RDr = l.Receipts.Where(x => x.ReceiptDate < dtFrom).Sum(x => x.Amount);
            RCr = l.ReceiptDetails.Where(x => x.Receipt.ReceiptDate < dtFrom).Sum(x => x.Amount);

            JDr = l.JournalDetails.Where(x => x.Journal.JournalDate < dtFrom).Sum(x => x.DrAmt);
            JCr = l.JournalDetails.Where(x => x.Journal.JournalDate < dtFrom).Sum(x => x.CrAmt);

            OPDr = OPDr + PDr + RDr + JDr;
            OPCr = OPCr + PCr + RCr + JCr;


            PDr = l.PaymentDetails.Where(x => x.Payment.PaymentDate >= dtFrom && x.Payment.PaymentDate <= dtTo).Sum(x => x.Amount);
            PCr = l.Payments.Where(x => x.PaymentDate >= dtFrom && x.PaymentDate <= dtTo).Sum(x => x.Amount);

            RDr = l.Receipts.Where(x => x.ReceiptDate >= dtFrom && x.ReceiptDate <= dtTo).Sum(x => x.Amount);
            RCr = l.ReceiptDetails.Where(x => x.Receipt.ReceiptDate >= dtFrom && x.Receipt.ReceiptDate <= dtTo).Sum(x => x.Amount);

            JDr = l.JournalDetails.Where(x => x.Journal.JournalDate >= dtFrom && x.Journal.JournalDate <= dtTo).Sum(x => x.DrAmt);
            JCr = l.JournalDetails.Where(x => x.Journal.JournalDate >= dtFrom && x.Journal.JournalDate <= dtTo).Sum(x => x.CrAmt);

            Dr = OPDr + PDr + RDr + JDr;
            Cr = OPCr + PCr + RCr + JCr;

            if (OPDr > OPCr)
            {
                OPDr = Math.Abs(OPDr - OPCr);
                OPCr = 0;
            }
            else
            {
                OPCr = Math.Abs(OPDr - OPCr);
                OPDr = 0;
            }

            if (Dr > Cr)
            {
                Dr = Math.Abs(Dr - Cr);
                Cr = 0;
            }
            else
            {
                Cr = Math.Abs(Dr - Cr);
                Dr = 0;
            }
        }
Exemplo n.º 8
0
        private void btnSearch_Click(object sender, EventArgs e)
        {
            DAL.Ledger ld = new DAL.Ledger();
            ld.Search  = txtSearch.Text;
            ld.Contact = Convert.ToString(txtContact.Text);
            ld.Email   = Convert.ToString(txtEmail.Text);

            //dateSearch
            ld.isDateSearch = ucDateSearch1.isEnabled;
            ld.DateFrom     = ucDateSearch1.DateFrom;
            ld.DateTo       = ucDateSearch1.DateTo;

            dgvLedger.DataSource = ld.select().Tables[0];
        }
Exemplo n.º 9
0
        public string MailMessage()
        {
            string s = "";

            DAL.Ledger l = new DAL.Ledger();
            l.Email = Request.QueryString["email"];

            if (l.SelectByEmail())
            {
                s += "HI, " + l.Name;
                s += "<a href=\"http://localhost:63211/active.aspx?email=" + l.Email + "\">Active</a>";
            }


            return(s);
        }
Exemplo n.º 10
0
        private BLL.Ledger LedgerDAL_BLL(DAL.Ledger ledgerFrom)
        {
            BLL.Ledger ledgerTo = new BLL.Ledger();
            try
            {
                ledgerTo = ledgerFrom.toCopy <BLL.Ledger>(new BLL.Ledger());

                ledgerTo.AccountGroup = AccountGroupDAL_BLL(ledgerFrom.AccountGroup);

                //ledgerTo.CreditLimitType = new BLL.CreditLimitType();
                //ledgerFrom.CreditLimitType.toCopy<BLL.CreditLimitType>(ledgerTo.CreditLimitType);
            }
            catch (Exception ex)
            {
            }
            return(ledgerTo);
        }
Exemplo n.º 11
0
        protected void btnLogin_Click(object sender, EventArgs e)
        {
            int er = 0;

            lblMessage.Text = "";
            //
            //
            //

            if (er > 0)
            {
                return;
            }

            DAL.Ledger l = new DAL.Ledger();

            l.Email    = txtEmail.Text;
            l.Password = txtPassword.Text;

            if (l.Login())
            {
                //check the email is in userActive table

                Session["id"]   = l.Id;
                Session["name"] = l.Name;
                Session["type"] = "A";

                if (chkRemember.Checked)
                {
                    //set cokkie for id, name, type
                }


                if (Session["rdr"].ToString() == "")
                {
                    Response.Redirect("Default.aspx");
                }
                Response.Redirect(Session["rdr"].ToString());
            }
            else
            {
                lblMessage.Text      = "Invalid Login";
                lblMessage.ForeColor = System.Drawing.Color.Red;
            }
        }
Exemplo n.º 12
0
 private BLL.Ledger LedgerDAL_BLL(DAL.Ledger ledgerFrom)
 {
     BLL.Ledger ledgerTo = new BLL.Ledger();
     try
     {
         ledgerTo = ledgerFrom.toCopy <BLL.Ledger>(new BLL.Ledger());
         ledgerTo.AccountGroup = AccountGroupDAL_BLL(ledgerFrom.AccountGroup);
         var bal = ledgerFrom.ACYearLedgerBalances.Where(x => x.ACYearMaster.ACYear == Caller.AccYear).FirstOrDefault();
         if (bal != null)
         {
             ledgerTo.OPDr = bal.DrAmt ?? 0;
             ledgerTo.OPCr = bal.CrAmt ?? 0;
         }
     }
     catch (Exception ex)
     {
     }
     return(ledgerTo);
 }
Exemplo n.º 13
0
        private void frmTransactionNew_Load(object sender, EventArgs e)
        {
            DAL.Ledger lgr = new DAL.Ledger();
            cmbEmployee.Source(lgr.Select());
            cmbLedger.Source(lgr.Select());
            cmbVoucher.Source(new DAL.Voucher().Select());
            cmbVoucher.SelectedValue = VoucherId;
            cmbVoucher.Enabled       = false;

            colLedger.DataSource    = lgr.Select().Tables[0];
            colLedger.DisplayMember = "name";
            colLedger.ValueMember   = "id";

            voucher.Id = VoucherId;
            voucher.SelectById();
            this.Text = voucher.Name;


            loadNumber();
        }
Exemplo n.º 14
0
        void AccountSetup(BLL.FundMaster cmp)
        {
            DAL.AccountGroup pr = new DAL.AccountGroup();
            pr.GroupName    = BLL.DataKeyValue.Primary_Key;
            pr.GroupCode    = string.Empty;
            pr.FundMasterId = cmp.Id;
            DB.AccountGroups.Add(pr);
            DB.SaveChanges();
            SetDataKeyValue(cmp.Id, pr.GroupName, pr.Id);


            AccountSetup_Asset(pr);
            AccountSetup_Liabilities(pr);
            AccountSetup_Income(pr);
            AccountSetup_Expense(pr);

            DAL.Ledger PL = new DAL.Ledger();
            PL.LedgerName     = BLL.DataKeyValue.Profit_Loss_Ledger_Key;
            PL.AccountGroupId = pr.Id;
            DB.Ledgers.Add(PL);
            DB.SaveChanges();
            SetDataKeyValue(pr.FundMasterId, PL.LedgerName, PL.Id);
        }
Exemplo n.º 15
0
        void AccountSetup(BLL.CompanyDetail cmp)
        {
            DAL.AccountGroup pr = new DAL.AccountGroup();
            pr.GroupName = BLL.DataKeyValue.Primary_Key;
            pr.GroupCode = "";
            pr.CompanyId = cmp.Id;
            DB.AccountGroups.Add(pr);
            DB.SaveChanges();
            insertDataKeyValue(cmp.Id, pr.GroupName, pr.Id);


            AccountSetup_Asset(pr);
            AccountSetup_Liabilities(pr);
            AccountSetup_Income(pr);
            AccountSetup_Expense(pr);

            DAL.Ledger PL = new DAL.Ledger();
            PL.LedgerName     = BLL.DataKeyValue.Profit_Loss_Ledger_Key;
            PL.AccountGroupId = pr.Id;
            DB.Ledgers.Add(PL);
            DB.SaveChanges();
            insertDataKeyValue(pr.CompanyId, PL.LedgerName, PL.Id);
        }
Exemplo n.º 16
0
        public int CompanyDetail_Save(BLL.CompanyDetail cm)
        {
            try
            {
                cm.IsActive = true;
                DAL.CompanyDetail d = DB.CompanyDetails.Where(x => x.Id == cm.Id).FirstOrDefault();

                if (d == null)
                {
                    d = new DAL.CompanyDetail();
                    DB.CompanyDetails.Add(d);

                    cm.toCopy <DAL.CompanyDetail>(d);

                    DB.SaveChanges();
                    cm.Id = d.Id;
                    if (d.Id != 0)
                    {
                        CompanySetup(cm);
                        CurrencySetup(cm);
                        if (d.UnderCompanyId != null)
                        {
                            var lstCompany = DB.CompanyDetails.Where(x => x.Id == d.UnderCompanyId || (x.Id != d.Id && x.UnderCompanyId == d.UnderCompanyId)).ToList();
                            int AGId       = DB.DataKeyValues.Where(x => x.CompanyId == cm.Id && x.DataKey == BLL.DataKeyValue.BranchDivisions_Key).FirstOrDefault().DataValue;

                            foreach (var c in lstCompany)
                            {
                                DAL.Ledger dl1 = new DAL.Ledger();
                                dl1.LedgerName     = string.Format("{0}-{1}", cm.CompanyType == "Company" ? "CM" : (cm.CompanyType == "Warehouse" ? "WH" : "DL"), cm.CompanyName);
                                dl1.AccountGroupId = DB.DataKeyValues.Where(x => x.CompanyId == c.Id && x.DataKey == BLL.DataKeyValue.BranchDivisions_Key).FirstOrDefault().DataValue;
                                dl1.AddressLine1   = cm.AddressLine1;
                                dl1.AddressLine2   = cm.AddressLine2;
                                dl1.CityName       = cm.CityName;
                                dl1.EMailId        = cm.EMailId;
                                dl1.GSTNo          = cm.GSTNo;
                                dl1.MobileNo       = cm.MobileNo;
                                dl1.TelephoneNo    = cm.TelephoneNo;
                                DB.Ledgers.Add(dl1);
                                DB.SaveChanges();

                                DAL.Ledger dl2 = new DAL.Ledger();
                                dl2.LedgerName     = string.Format("{0}-{1}", c.CompanyType == "Company" ? "CM" : (c.CompanyType == "Warehouse" ? "WH" : "DL"), c.CompanyName);
                                dl2.AccountGroupId = AGId;
                                dl2.AddressLine1   = c.AddressLine1;
                                dl2.AddressLine2   = c.AddressLine2;
                                dl2.CityName       = c.CityName;
                                dl2.EMailId        = c.EMailId;
                                dl2.GSTNo          = c.GSTNo;
                                dl2.MobileNo       = c.MobileNo;
                                dl2.TelephoneNo    = c.TelephoneNo;
                                DB.Ledgers.Add(dl2);
                                DB.SaveChanges();
                            }
                        }
                    }
                }
                else
                {
                    var CName = d.CompanyName;
                    cm.toCopy <DAL.CompanyDetail>(d);
                    DB.SaveChanges();

                    var LName     = string.Format("{0}-{1}", cm.CompanyType == "Company" ? "CM" : (cm.CompanyType == "Warehouse" ? "WH" : "DL"), CName);
                    var lstLedger = DB.Ledgers.Where(x => x.LedgerName == LName).ToList();
                    foreach (var dl in lstLedger)
                    {
                        dl.LedgerName   = string.Format("{0}-{1}", cm.CompanyType == "Company" ? "CM" : (cm.CompanyType == "Warehouse" ? "WH" : "DL"), cm.CompanyName);
                        dl.AddressLine1 = cm.AddressLine1;
                        dl.AddressLine2 = cm.AddressLine2;
                        dl.CityName     = cm.CityName;
                        dl.EMailId      = cm.EMailId;
                        dl.GSTNo        = cm.GSTNo;
                        dl.MobileNo     = cm.MobileNo;
                        dl.TelephoneNo  = cm.TelephoneNo;
                    }
                    DB.SaveChanges();
                }

                //  Clients.All.CompanyDetail_Save(cm);
                Clients.Clients(OtherLoginClientsOnGroup).CompanyDetail_Save(cm);

                return(cm.Id);
            }
            catch (Exception ex) { }
            return(0);
        }
Exemplo n.º 17
0
        void LedgerBalance(DAL.Ledger l, DateTime dtFrom, DateTime dtTo, ref decimal OPDr, ref decimal OPCr, ref decimal Dr, ref decimal Cr)
        {
            decimal PDr, PCr, RDr, RCr, JDr, JCr;

            var bal = l.ACYearLedgerBalances.Where(x => x.ACYearMaster.ACYear == Caller.AccYear).FirstOrDefault();

            if (bal != null)
            {
                OPDr = bal.DrAmt ?? 0;
                OPCr = bal.CrAmt ?? 0;
            }
            else
            {
                OPDr = 0;
                OPCr = 0;
            }

            PDr = l.PaymentDetails.Where(x => x.Payment.PaymentDate < dtFrom).Sum(x => x.Amount);
            PCr = l.Payments.Where(x => x.PaymentDate < dtFrom).Sum(x => x.Amount);

            RDr = l.Receipts.Where(x => x.ReceiptDate < dtFrom).Sum(x => x.Amount);
            RCr = l.ReceiptDetails.Where(x => x.Receipt.ReceiptDate < dtFrom).Sum(x => x.Amount);

            JDr = l.JournalDetails.Where(x => x.Journal.JournalDate < dtFrom).Sum(x => x.DrAmt);
            JCr = l.JournalDetails.Where(x => x.Journal.JournalDate < dtFrom).Sum(x => x.CrAmt);

            OPDr = OPDr + PDr + RDr + JDr;
            OPCr = OPCr + PCr + RCr + JCr;


            PDr = l.PaymentDetails.Where(x => x.Payment.PaymentDate >= dtFrom && x.Payment.PaymentDate <= dtTo).Sum(x => x.Amount);
            PCr = l.Payments.Where(x => x.PaymentDate >= dtFrom && x.PaymentDate <= dtTo).Sum(x => x.Amount);

            RDr = l.Receipts.Where(x => x.ReceiptDate >= dtFrom && x.ReceiptDate <= dtTo).Sum(x => x.Amount);
            RCr = l.ReceiptDetails.Where(x => x.Receipt.ReceiptDate >= dtFrom && x.Receipt.ReceiptDate <= dtTo).Sum(x => x.Amount);

            JDr = l.JournalDetails.Where(x => x.Journal.JournalDate >= dtFrom && x.Journal.JournalDate <= dtTo).Sum(x => x.DrAmt);
            JCr = l.JournalDetails.Where(x => x.Journal.JournalDate >= dtFrom && x.Journal.JournalDate <= dtTo).Sum(x => x.CrAmt);

            Dr = OPDr + PDr + RDr + JDr;
            Cr = OPCr + PCr + RCr + JCr;

            if (OPDr > OPCr)
            {
                OPDr = Math.Abs(OPDr - OPCr);
                OPCr = 0;
            }
            else
            {
                OPCr = Math.Abs(OPDr - OPCr);
                OPDr = 0;
            }

            if (Dr > Cr)
            {
                Dr = Math.Abs(Dr - Cr);
                Cr = 0;
            }
            else
            {
                Cr = Math.Abs(Dr - Cr);
                Dr = 0;
            }
        }
Exemplo n.º 18
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            int er = 0;

            ep.Clear();

            if (txtName.Text == "")
            {
                er++;
                ep.SetError(txtName, "Requred");
            }

            if (txtContact.Text == "")
            {
                er++;
                ep.SetError(txtContact, "Required");
            }
            if (txtEmail.Text == "")
            {
                er++;
                ep.SetError(txtEmail, "Required");
            }
            if (txtPassword.Text == "")
            {
                er++;
                ep.SetError(txtPassword, "Required");
            }
            if (txtAddress.Text == "")
            {
                er++;
                ep.SetError(txtAddress, "Required");
            }
            if (cmbCity.SelectedValue == null || cmbCity.SelectedValue.ToString() == "")
            {
                er++;
                ep.SetError(cmbCity, "Required");
            }
            if (dtpDateOfBirth.Value.ToString() == "")
            {
                er++;
                ep.SetError(dtpDateOfBirth, "Required");
            }
            if (pbImage.Image == null)
            {
                er++;
                ep.SetError(pbImage, "Required");
            }

            if (er > 0)
            {
                return;
            }

            DAL.Ledger ld = new DAL.Ledger();

            ld.Name        = txtName.Text;
            ld.Contact     = txtContact.Text;
            ld.Email       = txtEmail.Text;
            ld.Password    = txtPassword.Text;
            ld.Gender      = Convert.ToInt32(cmbGender.SelectedValue);
            ld.Address     = txtAddress.Text;
            ld.CityId      = Convert.ToInt32(cmbCity.SelectedValue);
            ld.DateOfBirth = Convert.ToDateTime(dtpDateOfBirth.Value);
            ld.CreateDate  = Convert.ToDateTime(DateTime.Now);
            ld.Type        = Convert.ToString(cmbType.SelectedValue);
            ld.Image       = BDJBatch18.POS.FimeImage.ImageToByte(pbImage.Image);

            if (ld.insert())
            {
                MessageBox.Show("Image Saved");
                txtName.Text            = "";
                txtContact.Text         = "";
                txtEmail.Text           = "";
                txtPassword.Text        = "";
                cmbGender.SelectedValue = -1;
                txtAddress.Text         = "";
                cmbCity.SelectedValue   = -1;
                dtpDateOfBirth.Text     = "";
                cmbType.SelectedValue   = -1;
                pbImage.Image           = null;

                txtName.Focus();
            }
            else
            {
                MessageBox.Show(ld.Error);
            }
        }
Exemplo n.º 19
0
        void AccountSetup_Expense(DAL.AccountGroup pr)
        {
            DAL.AccountGroup Exp = new DAL.AccountGroup();
            Exp.GroupName    = BLL.DataKeyValue.Expenses_Key;
            Exp.GroupCode    = "400";
            Exp.FundMasterId = pr.FundMasterId;
            Exp.UnderGroupId = pr.Id;
            DB.AccountGroups.Add(Exp);
            DB.SaveChanges();
            SetDataKeyValue(pr.FundMasterId, Exp.GroupName, Exp.Id);

            #region Direct Expense

            DAL.AccountGroup DExp = new DAL.AccountGroup();
            DExp.GroupName    = BLL.DataKeyValue.DirectExpenses_Key;
            DExp.GroupCode    = "410";
            DExp.FundMasterId = pr.FundMasterId;
            DExp.UnderGroupId = Exp.Id;
            DB.AccountGroups.Add(DExp);
            DB.SaveChanges();
            SetDataKeyValue(pr.FundMasterId, DExp.GroupName, DExp.Id);

            #endregion

            #region Indirect Expense

            DAL.AccountGroup IndExp = new DAL.AccountGroup();
            IndExp.GroupName    = BLL.DataKeyValue.IndirectExpense_Key;
            IndExp.GroupCode    = "320";
            IndExp.FundMasterId = pr.FundMasterId;
            IndExp.UnderGroupId = Exp.Id;
            DB.AccountGroups.Add(IndExp);
            DB.SaveChanges();
            SetDataKeyValue(pr.FundMasterId, IndExp.GroupName, IndExp.Id);
            #endregion

            DAL.AccountGroup Pur = new DAL.AccountGroup();
            Pur.GroupName    = BLL.DataKeyValue.PurchaseAccount_Key;
            Pur.GroupCode    = "330";
            Pur.FundMasterId = pr.FundMasterId;
            Pur.UnderGroupId = Exp.Id;
            DB.AccountGroups.Add(Pur);
            DB.SaveChanges();
            SetDataKeyValue(pr.FundMasterId, Pur.GroupName, Pur.Id);



            DAL.Ledger PurL = new DAL.Ledger();
            PurL.LedgerName     = BLL.DataKeyValue.PurchaseAccount_Ledger_Key;
            PurL.AccountGroupId = Pur.Id;
            DB.Ledgers.Add(PurL);
            DB.SaveChanges();
            SetDataKeyValue(pr.FundMasterId, PurL.LedgerName, PurL.Id);

            DAL.Ledger PRL = new DAL.Ledger();
            PRL.LedgerName     = BLL.DataKeyValue.Purchase_Return_Ledger_Key;
            PRL.AccountGroupId = Pur.Id;
            DB.Ledgers.Add(PRL);
            DB.SaveChanges();
            SetDataKeyValue(pr.FundMasterId, PRL.LedgerName, PRL.Id);

            DAL.Ledger JO = new DAL.Ledger();
            JO.LedgerName     = BLL.DataKeyValue.JobOrderIssued_Ledger_Key;
            JO.AccountGroupId = Exp.Id;
            DB.Ledgers.Add(JO);
            DB.SaveChanges();
            SetDataKeyValue(pr.FundMasterId, JO.LedgerName, JO.Id);

            DAL.AccountGroup salary = new DAL.AccountGroup();
            salary.GroupName    = BLL.DataKeyValue.Salary_Key;
            salary.GroupCode    = "340";
            salary.FundMasterId = pr.FundMasterId;
            salary.UnderGroupId = IndExp.Id;
            DB.AccountGroups.Add(salary);
            DB.SaveChanges();
            SetDataKeyValue(pr.FundMasterId, salary.GroupName, salary.Id);
        }
Exemplo n.º 20
0
        void AccountSetup_Income(DAL.AccountGroup pr)
        {
            DAL.AccountGroup Inc = new DAL.AccountGroup();
            Inc.GroupName    = BLL.DataKeyValue.Income_Key;
            Inc.GroupCode    = "300";
            Inc.FundMasterId = pr.FundMasterId;
            Inc.UnderGroupId = pr.Id;
            DB.AccountGroups.Add(Inc);
            DB.SaveChanges();
            SetDataKeyValue(pr.FundMasterId, Inc.GroupName, Inc.Id);



            #region Direct Income

            DAL.AccountGroup DInc = new DAL.AccountGroup();
            DInc.GroupName    = BLL.DataKeyValue.DirectIncome_Key;
            DInc.GroupCode    = "310";
            DInc.FundMasterId = pr.FundMasterId;
            DInc.UnderGroupId = Inc.Id;
            DB.AccountGroups.Add(DInc);
            DB.SaveChanges();
            SetDataKeyValue(pr.FundMasterId, DInc.GroupName, DInc.Id);

            #endregion

            #region Indirect Income

            DAL.AccountGroup IndInc = new DAL.AccountGroup();
            IndInc.GroupName    = BLL.DataKeyValue.IndirectIncome_Key;
            IndInc.GroupCode    = "320";
            IndInc.FundMasterId = pr.FundMasterId;
            IndInc.UnderGroupId = Inc.Id;
            DB.AccountGroups.Add(IndInc);
            DB.SaveChanges();
            SetDataKeyValue(pr.FundMasterId, IndInc.GroupName, IndInc.Id);

            #endregion

            DAL.AccountGroup Sa = new DAL.AccountGroup();
            Sa.GroupName    = BLL.DataKeyValue.SalesAccount_Key;
            Sa.GroupCode    = "330";
            Sa.FundMasterId = pr.FundMasterId;
            Sa.UnderGroupId = Inc.Id;
            DB.AccountGroups.Add(Sa);
            DB.SaveChanges();
            SetDataKeyValue(pr.FundMasterId, Sa.GroupName, Sa.Id);

            DAL.Ledger salL = new DAL.Ledger();
            salL.LedgerName     = BLL.DataKeyValue.SalesAccount_Ledger_Key;
            salL.AccountGroupId = Sa.Id;
            DB.Ledgers.Add(salL);
            DB.SaveChanges();
            SetDataKeyValue(pr.FundMasterId, salL.LedgerName, salL.Id);

            DAL.Ledger SRL = new DAL.Ledger();
            SRL.LedgerName     = BLL.DataKeyValue.Sales_Return_Ledger_Key;
            SRL.AccountGroupId = Sa.Id;
            DB.Ledgers.Add(SRL);
            DB.SaveChanges();
            SetDataKeyValue(pr.FundMasterId, SRL.LedgerName, SRL.Id);

            DAL.Ledger JR = new DAL.Ledger();
            JR.LedgerName     = BLL.DataKeyValue.JobOrderReceived_Ledger_Key;
            JR.AccountGroupId = Inc.Id;
            DB.Ledgers.Add(JR);
            DB.SaveChanges();
            SetDataKeyValue(pr.FundMasterId, JR.LedgerName, JR.Id);
        }
Exemplo n.º 21
0
        void AccountSetup_Liabilities(DAL.AccountGroup pr)
        {
            DAL.AccountGroup liab = new DAL.AccountGroup();
            liab.GroupName    = BLL.DataKeyValue.Liabilities_Key;
            liab.GroupCode    = "200";
            liab.FundMasterId = pr.FundMasterId;
            liab.UnderGroupId = pr.Id;
            DB.AccountGroups.Add(liab);
            DB.SaveChanges();
            SetDataKeyValue(pr.FundMasterId, liab.GroupName, liab.Id);

            #region Current Liabilities
            DAL.AccountGroup cl = new DAL.AccountGroup();
            cl.GroupName    = BLL.DataKeyValue.CurrentLiabilities_Key;
            cl.GroupCode    = "210";
            cl.UnderGroupId = liab.Id;
            cl.FundMasterId = pr.FundMasterId;
            DB.AccountGroups.Add(cl);
            DB.SaveChanges();
            SetDataKeyValue(pr.FundMasterId, cl.GroupName, cl.Id);

            DAL.AccountGroup DT = new DAL.AccountGroup();
            DT.GroupName    = BLL.DataKeyValue.DutiesTaxes_Key;
            DT.GroupCode    = "211";
            DT.UnderGroupId = cl.Id;
            DT.FundMasterId = pr.FundMasterId;
            DB.AccountGroups.Add(DT);
            DB.SaveChanges();
            SetDataKeyValue(pr.FundMasterId, DT.GroupName, DT.Id);

            DAL.Ledger IT = new DAL.Ledger();
            IT.LedgerName     = BLL.DataKeyValue.Input_Tax_Ledger_Key;
            IT.AccountGroupId = DT.Id;
            DB.Ledgers.Add(IT);
            DB.SaveChanges();
            SetDataKeyValue(pr.FundMasterId, IT.LedgerName, IT.Id);


            DAL.Ledger OT = new DAL.Ledger();
            OT.LedgerName     = BLL.DataKeyValue.Output_Tax_Ledger_Key;
            OT.AccountGroupId = DT.Id;
            DB.Ledgers.Add(OT);
            DB.SaveChanges();
            SetDataKeyValue(pr.FundMasterId, OT.LedgerName, OT.Id);

            DAL.AccountGroup prov = new DAL.AccountGroup();
            prov.GroupName    = BLL.DataKeyValue.Provisions_Key;
            prov.GroupCode    = "212";
            prov.UnderGroupId = cl.Id;
            prov.FundMasterId = pr.FundMasterId;
            DB.AccountGroups.Add(prov);
            DB.SaveChanges();
            SetDataKeyValue(pr.FundMasterId, prov.GroupName, prov.Id);

            DAL.AccountGroup sc = new DAL.AccountGroup();
            sc.GroupName    = BLL.DataKeyValue.SundryCreditors_Key;
            sc.GroupCode    = "212";
            sc.UnderGroupId = cl.Id;
            sc.FundMasterId = pr.FundMasterId;
            DB.AccountGroups.Add(sc);
            DB.SaveChanges();
            SetDataKeyValue(pr.FundMasterId, sc.GroupName, sc.Id);


            #region Loans
            DAL.AccountGroup l = new DAL.AccountGroup();
            l.GroupName    = BLL.DataKeyValue.Loans_Key;
            l.GroupCode    = "220";
            l.UnderGroupId = liab.Id;
            l.FundMasterId = pr.FundMasterId;
            DB.AccountGroups.Add(l);
            DB.SaveChanges();
            SetDataKeyValue(pr.FundMasterId, l.GroupName, l.Id);


            DAL.AccountGroup BOAc = new DAL.AccountGroup();
            BOAc.GroupName    = BLL.DataKeyValue.BankODAc_Key;
            BOAc.GroupCode    = "221";
            BOAc.UnderGroupId = l.Id;
            BOAc.FundMasterId = pr.FundMasterId;
            DB.AccountGroups.Add(BOAc);
            DB.SaveChanges();
            SetDataKeyValue(pr.FundMasterId, BOAc.GroupName, BOAc.Id);

            DAL.AccountGroup SL = new DAL.AccountGroup();
            SL.GroupName    = BLL.DataKeyValue.SecuredLoans_Key;
            SL.GroupCode    = "221";
            SL.UnderGroupId = l.Id;
            SL.FundMasterId = pr.FundMasterId;
            DB.AccountGroups.Add(SL);
            DB.SaveChanges();
            SetDataKeyValue(pr.FundMasterId, SL.GroupName, SL.Id);

            DAL.AccountGroup USL = new DAL.AccountGroup();
            USL.GroupName    = BLL.DataKeyValue.UnSecuredLoans_Key;
            USL.GroupCode    = "222";
            USL.UnderGroupId = l.Id;
            USL.FundMasterId = pr.FundMasterId;
            DB.AccountGroups.Add(USL);
            DB.SaveChanges();
            SetDataKeyValue(pr.FundMasterId, USL.GroupName, USL.Id);

            #endregion


            DAL.AccountGroup BD = new DAL.AccountGroup();
            BD.GroupName    = BLL.DataKeyValue.BranchDivisions_Key;
            BD.GroupCode    = "230";
            BD.UnderGroupId = liab.Id;
            BD.FundMasterId = pr.FundMasterId;
            DB.AccountGroups.Add(BD);
            DB.SaveChanges();
            SetDataKeyValue(pr.FundMasterId, BD.GroupName, BD.Id);



            DAL.AccountGroup Cap = new DAL.AccountGroup();
            Cap.GroupName    = BLL.DataKeyValue.CapitalAccount_Key;
            Cap.GroupCode    = "240";
            Cap.UnderGroupId = liab.Id;
            Cap.FundMasterId = pr.FundMasterId;
            DB.AccountGroups.Add(Cap);
            DB.SaveChanges();
            SetDataKeyValue(pr.FundMasterId, Cap.GroupName, Cap.Id);

            DAL.AccountGroup RS = new DAL.AccountGroup();
            RS.GroupName    = BLL.DataKeyValue.ReservesSurplus_Key;
            RS.GroupCode    = "250";
            RS.UnderGroupId = liab.Id;
            RS.FundMasterId = pr.FundMasterId;
            DB.AccountGroups.Add(RS);
            DB.SaveChanges();
            SetDataKeyValue(pr.FundMasterId, RS.GroupName, RS.Id);

            DAL.AccountGroup SAC = new DAL.AccountGroup();
            SAC.GroupName    = BLL.DataKeyValue.SuspenseAc_Key;
            SAC.GroupCode    = "260";
            SAC.UnderGroupId = liab.Id;
            SAC.FundMasterId = pr.FundMasterId;
            DB.AccountGroups.Add(SAC);
            DB.SaveChanges();
            SetDataKeyValue(pr.FundMasterId, SAC.GroupName, SAC.Id);

            #endregion
        }
Exemplo n.º 22
0
        void AccountSetup_Asset(DAL.AccountGroup pr)
        {
            DAL.AccountGroup ast = new DAL.AccountGroup();
            ast.GroupName    = BLL.DataKeyValue.Assets_Key;
            ast.GroupCode    = "100";
            ast.FundMasterId = pr.FundMasterId;
            ast.UnderGroupId = pr.Id;
            DB.AccountGroups.Add(ast);
            DB.SaveChanges();
            SetDataKeyValue(pr.FundMasterId, ast.GroupName, ast.Id);


            #region Current Assets
            DAL.AccountGroup ca = new DAL.AccountGroup();
            ca.GroupName    = BLL.DataKeyValue.CurrentAssets_Key;
            ca.GroupCode    = "110";
            ca.UnderGroupId = ast.Id;
            ca.FundMasterId = pr.FundMasterId;
            DB.AccountGroups.Add(ca);
            DB.SaveChanges();
            SetDataKeyValue(pr.FundMasterId, ca.GroupName, ca.Id);


            DAL.AccountGroup ch = new DAL.AccountGroup();
            ch.GroupName    = BLL.DataKeyValue.CashInHand_Key;
            ch.GroupCode    = "111";
            ch.UnderGroupId = ca.Id;
            ch.FundMasterId = pr.FundMasterId;
            DB.AccountGroups.Add(ch);
            DB.SaveChanges();
            SetDataKeyValue(pr.FundMasterId, ch.GroupName, ch.Id);

            DAL.Ledger cL = new DAL.Ledger();
            cL.LedgerName     = BLL.DataKeyValue.CashLedger_Key;
            cL.AccountGroupId = ch.Id;
            DB.Ledgers.Add(cL);
            DB.SaveChanges();
            SetDataKeyValue(pr.FundMasterId, cL.LedgerName, cL.Id);

            DAL.AccountGroup dp = new DAL.AccountGroup();
            dp.GroupName    = BLL.DataKeyValue.Deposits_Key;
            dp.GroupCode    = "112";
            dp.UnderGroupId = ca.Id;
            dp.FundMasterId = pr.FundMasterId;
            DB.AccountGroups.Add(dp);
            DB.SaveChanges();
            SetDataKeyValue(pr.FundMasterId, dp.GroupName, dp.Id);


            DAL.AccountGroup la = new DAL.AccountGroup();
            la.GroupName    = BLL.DataKeyValue.LoansandAdvances_Key;
            la.GroupCode    = "113";
            la.UnderGroupId = ca.Id;
            la.FundMasterId = pr.FundMasterId;
            DB.AccountGroups.Add(la);
            DB.SaveChanges();
            SetDataKeyValue(pr.FundMasterId, la.GroupName, la.Id);


            DAL.AccountGroup ba = new DAL.AccountGroup();
            ba.GroupName    = BLL.DataKeyValue.BankAccounts_Key;
            ba.GroupCode    = "114";
            ba.UnderGroupId = ca.Id;
            ba.FundMasterId = pr.FundMasterId;
            DB.AccountGroups.Add(ba);
            DB.SaveChanges();
            SetDataKeyValue(pr.FundMasterId, ba.GroupName, ba.Id);


            DAL.AccountGroup SIH = new DAL.AccountGroup();
            SIH.GroupName    = BLL.DataKeyValue.StockInHand_Key;
            SIH.GroupCode    = "115";
            SIH.UnderGroupId = ca.Id;
            SIH.FundMasterId = pr.FundMasterId;
            DB.AccountGroups.Add(SIH);
            DB.SaveChanges();
            SetDataKeyValue(pr.FundMasterId, SIH.GroupName, SIH.Id);

            DAL.Ledger st = new DAL.Ledger();
            st.LedgerName     = BLL.DataKeyValue.Stock_In_Hand_Ledger_Key;
            st.AccountGroupId = SIH.Id;
            DB.Ledgers.Add(st);
            DB.SaveChanges();
            SetDataKeyValue(pr.FundMasterId, st.LedgerName, st.Id);

            DAL.Ledger sti = new DAL.Ledger();
            sti.LedgerName     = BLL.DataKeyValue.Stock_Inward_Ledger_Key;
            sti.AccountGroupId = SIH.Id;
            DB.Ledgers.Add(sti);
            DB.SaveChanges();
            SetDataKeyValue(pr.FundMasterId, sti.LedgerName, sti.Id);

            DAL.Ledger sto = new DAL.Ledger();
            sto.LedgerName     = BLL.DataKeyValue.Stock_Outward_Ledger_Key;
            sto.AccountGroupId = SIH.Id;
            DB.Ledgers.Add(sto);
            DB.SaveChanges();
            SetDataKeyValue(pr.FundMasterId, sto.LedgerName, sto.Id);

            DAL.AccountGroup sd = new DAL.AccountGroup();
            sd.GroupName    = BLL.DataKeyValue.SundryDebtors_Key;
            sd.GroupCode    = "116";
            sd.UnderGroupId = ca.Id;
            sd.FundMasterId = pr.FundMasterId;
            DB.AccountGroups.Add(sd);
            DB.SaveChanges();
            SetDataKeyValue(pr.FundMasterId, sd.GroupName, sd.Id);


            DAL.Ledger SP = new DAL.Ledger();
            SP.LedgerName     = BLL.DataKeyValue.StockInProcess_Ledger_Key;
            SP.AccountGroupId = SIH.Id;
            DB.Ledgers.Add(SP);
            DB.SaveChanges();
            SetDataKeyValue(pr.FundMasterId, SP.LedgerName, SP.Id);

            DAL.Ledger SS = new DAL.Ledger();
            SS.LedgerName     = BLL.DataKeyValue.StockSeperated_Ledger_Key;
            SS.AccountGroupId = SIH.Id;
            DB.Ledgers.Add(SS);
            DB.SaveChanges();
            SetDataKeyValue(pr.FundMasterId, SS.LedgerName, SS.Id);



            #endregion

            #region Fixed Assets

            DAL.AccountGroup fa = new DAL.AccountGroup();
            fa.GroupName    = BLL.DataKeyValue.FixedAssets_Key;
            fa.GroupCode    = "120";
            fa.UnderGroupId = ast.Id;
            fa.FundMasterId = pr.FundMasterId;
            DB.AccountGroups.Add(fa);
            DB.SaveChanges();
            SetDataKeyValue(pr.FundMasterId, fa.GroupName, fa.Id);

            #endregion


            #region Misc. Expenses

            DAL.AccountGroup me = new DAL.AccountGroup();
            me.GroupName    = BLL.DataKeyValue.MiscExpenses_Key;
            me.GroupCode    = "130";
            me.UnderGroupId = ast.Id;
            me.FundMasterId = pr.FundMasterId;
            DB.AccountGroups.Add(me);
            DB.SaveChanges();
            SetDataKeyValue(pr.FundMasterId, me.GroupName, me.Id);

            #endregion

            DAL.AccountGroup Inv = new DAL.AccountGroup();
            Inv.GroupName    = BLL.DataKeyValue.Investments_Key;
            Inv.GroupCode    = "140";
            Inv.UnderGroupId = ast.Id;
            Inv.FundMasterId = pr.FundMasterId;
            DB.AccountGroups.Add(Inv);
            DB.SaveChanges();
            SetDataKeyValue(pr.FundMasterId, Inv.GroupName, Inv.Id);
        }
Exemplo n.º 23
0
        private void btnSearch_Click(object sender, EventArgs e)
        {
            DAL.Ledger ledger = new DAL.Ledger();

            dgvData.DataSource = ledger.Select().Tables[0];
        }
Exemplo n.º 24
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            int er = 0;

            if (txtName.Text == "")
            {
                er++;
                ep.SetError(txtName, "Required");
            }
            if (txtContact.Text == "")
            {
                er++;
                ep.SetError(txtContact, "Required");
            }
            if (txtContactPerson.Text == "")
            {
                er++;
                ep.SetError(txtContactPerson, "Required");
            }
            if (txtPassword.Text == "")
            {
                er++;
                ep.SetError(txtPassword, "Required");
            }
            if (cmbCity.SelectedValue == null || cmbCity.SelectedValue.ToString() == "")
            {
                er++;
                ep.SetError(cmbCity, "Required");
            }
            if (cmbHead.SelectedValue == null || cmbHead.SelectedValue.ToString() == "")
            {
                er++;
                ep.SetError(cmbHead, "Required");
            }
            if (txtEmployee.Text == "")
            {
                er++;
                ep.SetError(txtEmployee, "Required");
            }
            if (er > 0)
            {
                return;
            }
            DAL.Ledger ledger = new DAL.Ledger();
            ledger.Name          = txtName.Text;
            ledger.Contact       = txtContact.Text;
            ledger.ContactPerson = txtContactPerson.Text;
            ledger.Address       = txtAddress.Text;
            ledger.Description   = txtDescription.Text;
            ledger.Email         = txtEmail.Text;
            ledger.EmployeeId    = Convert.ToInt32(txtEmployee.Text);
            ledger.Password      = txtPassword.Text;
            ledger.HeadId        = Convert.ToInt32(cmbHead.SelectedValue);
            ledger.CityId        = Convert.ToInt32(cmbCity.SelectedValue);
            ledger.CreateDate    = dateTime.Value;

            if (ledger.Insert())
            {
                MessageBox.Show("Data Saved");
                MyControls.Helper.clear(this);
                txtName.Focus();
            }
            else
            {
                MessageBox.Show(ledger.Error);
            }
        }