示例#1
0
        // GET: DebitNote/Create
        public ActionResult Create()
        {
            var errorViewModel = new ErrorViewModel();

            try
            {
                var supplieerList    = SelectListItemExtension.PopulateDropdownList(_DebitNoteService.BMSUnit.SupplierRepository.GetAll().ToList <tblSupplier>(), "Id", "SupplierName").ToList();
                var organizationList = SelectListItemExtension.PopulateDropdownList(_DebitNoteService.BMSUnit.OrganizationRepository.GetAll().ToList <tblOrganization>(), "Id", "Organization").ToList();

                var bankList = SelectListItemExtension.PopulateDropdownList(_DebitNoteService.BMSUnit.BankRepository.GetAll().ToList <tblBank>(), "Id", "BankName").ToList();

                var userOrganization = 3;     // Query and Set Defaul Organization Here
                var model            = new DebitNoteModel()
                {
                    ddlSupplier     = supplieerList,
                    DebitNoteDate   = DateTime.Now,
                    ddlOrganization = organizationList,
                    OrganizationId  = Convert.ToInt64(userOrganization),
                    ddlBank         = bankList,
                    //OrganizationId = Convert.ToInt64(userOrganization)
                };


                return(PartialView("_Create", model));
            }
            catch (Exception ex)
            {
                errorViewModel.ErrorMessage = CommonExceptionMessage.GetExceptionMessage(ex);
                return(PartialView("_ErrorPopUp", errorViewModel));
            }
        }
示例#2
0
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            DebitNoteModel objdebit = new DebitNoteModel();

            if (tbxVchNumber.Text.Trim() == "")
            {
                MessageBox.Show("Voucher Number Can Not Be Blank!");
                return;
            }

            objdebit.Voucher_Number    = Convert.ToInt32(tbxVchNumber.Text.Trim());
            objdebit.DN_Date           = Convert.ToDateTime(dtDate.Text);
            objdebit.Voucher_Series    = tbxVoucherSeries.Text.Trim();
            objdebit.Type              = cbxType.SelectedItem.ToString();
            objdebit.PDC_Date          = Convert.ToDateTime(dtPDC.Text);
            objdebit.LongNarration     = tbxLongNarratin.Text.Trim() == null ? string.Empty : tbxLongNarratin.Text.Trim();
            objdebit.TotalCreditAmount = Convert.ToDecimal(colCredit.SummaryItem.SummaryValue);
            objdebit.TotalDebitAmount  = Convert.ToDecimal(colDebit.SummaryItem.SummaryValue);
            //Debite Details
            AccountModel objDebit;

            List <AccountModel> lstDebitNotes = new List <AccountModel>();

            for (int i = 0; i < gdvDebit.DataRowCount; i++)
            {
                DataRow row = gdvDebit.GetDataRow(i);

                objDebit           = new AccountModel();
                objDebit.DC        = row["DC"].ToString();
                objDebit.Account   = row["Account"].ToString();
                objDebit.LedgerId  = objAccBL.GetLedgerIdByAccountName(row["Account"].ToString());
                objDebit.Debit     = row["Debit"].ToString().Length > 0 ? Convert.ToDecimal(row["Debit"].ToString()) : 0;
                objDebit.Credit    = row["Credit"].ToString().Length > 0 ? Convert.ToDecimal(row["Credit"].ToString()) : 0;
                objDebit.Narration = row["Narration"].ToString() == null ? string.Empty : row["Narration"].ToString();
                objDebit.AC_Id     = Convert.ToInt32(row["Ac_Id"].ToString() == string.Empty ? "0" : row["Ac_Id"].ToString());
                objDebit.ParentId  = Convert.ToInt32(row["ParentId"].ToString() == string.Empty ? "0" : row["ParentId"].ToString());
                lstDebitNotes.Add(objDebit);
            }

            objdebit.DebitAccountModel = lstDebitNotes;
            objdebit.DN_Id             = Convert.ToInt32(DNId);
            bool isSuccess = objDNbl.UpdateDebitNote(objdebit);

            if (isSuccess)
            {
                MessageBox.Show("Update Successfully!");
                DNId = 0;
                ClearControls();
                Transaction.List.DebitNotesList frmList = new Transaction.List.DebitNotesList();
                frmList.StartPosition = FormStartPosition.CenterScreen;
                frmList.ShowDialog();

                FillDebitNote();
            }
        }
示例#3
0
        public Debit_Note convertDebit(DebitNoteModel debitNote, string flag)
        {
            Debit_Note usingData = new Debit_Note();

            if (flag == "create")
            {
                usingData.debit_id         = debitNote.debit_id;
                usingData.start_date       = debitNote.start_date;
                usingData.end_date         = debitNote.end_date;
                usingData.create_by        = debitNote.create_by;
                usingData.create_on        = debitNote.create_on;
                usingData.edit_by          = debitNote.edit_by;
                usingData.paying_date      = debitNote.paying_date;
                usingData.reference        = debitNote.reference;
                usingData.record_date      = debitNote.record_date;
                usingData.customer_name    = debitNote.customer_name;
                usingData.billing_to       = debitNote.billing_to;
                usingData.cust_address     = debitNote.cust_address;
                usingData.customer_phone   = debitNote.customer_phone;
                usingData.bl               = debitNote.bl;
                usingData.container_number = debitNote.container_number;
                usingData.commodity        = debitNote.commodity;
                usingData.package_number   = debitNote.package_number;
                usingData.vessel           = debitNote.vessel;
                usingData.voy              = debitNote.voy;
                usingData.advance_money    = debitNote.advance_money;
            }
            else
            {
                usingData.id               = debitNote.id;
                usingData.debit_id         = debitNote.debit_id;
                usingData.start_date       = debitNote.start_date;
                usingData.end_date         = debitNote.end_date;
                usingData.create_by        = debitNote.create_by;
                usingData.create_on        = debitNote.create_on;
                usingData.edit_by          = debitNote.edit_by;
                usingData.paying_date      = debitNote.paying_date;
                usingData.reference        = debitNote.reference;
                usingData.record_date      = debitNote.record_date;
                usingData.customer_name    = debitNote.customer_name;
                usingData.billing_to       = debitNote.billing_to;
                usingData.cust_address     = debitNote.cust_address;
                usingData.customer_phone   = debitNote.customer_phone;
                usingData.bl               = debitNote.bl;
                usingData.container_number = debitNote.container_number;
                usingData.commodity        = debitNote.commodity;
                usingData.package_number   = debitNote.package_number;
                usingData.vessel           = debitNote.vessel;
                usingData.voy              = debitNote.voy;
                usingData.advance_money    = debitNote.advance_money;
            }

            return(usingData);
        }
示例#4
0
        // GET: DebitNote/Edit/By ID
        public ActionResult Edit(long id)
        {
            var errorViewModel = new ErrorViewModel();

            try
            {
                var model = _DebitNoteService.BMSUnit.DebitNoteRepository.GetByID(id);

                Session["DebitNoteId"] = model.Id;

                var supplieerList    = SelectListItemExtension.PopulateDropdownList(_DebitNoteService.BMSUnit.SupplierRepository.GetAll().ToList <tblSupplier>(), "Id", "SupplierName").ToList();
                var organizationList = SelectListItemExtension.PopulateDropdownList(_DebitNoteService.BMSUnit.OrganizationRepository.GetAll().ToList <tblOrganization>(), "Id", "Organization").ToList();
                var bankList         = SelectListItemExtension.PopulateDropdownList(_DebitNoteService.BMSUnit.BankRepository.GetAll().ToList <tblBank>(), "Id", "BankName").ToList();

                if (model != null)
                {
                    DebitNoteModel viewModel = new DebitNoteModel
                    {
                        Id            = model.Id,
                        DebitNoteNo   = model.DebitNoteNo,
                        DebitNoteDate = model.DebitNoteDate,

                        ddlSupplier = supplieerList,
                        SupplierId  = model.SupplierId,

                        ddlOrganization = organizationList,
                        OrganizationId  = Convert.ToInt64(model.OrganizationId),

                        ddlBank = bankList,
                        BankId  = model.BankId,

                        SupplierName    = _DebitNoteService.BMSUnit.SupplierRepository.GetByID(model.SupplierId).SupplierName,
                        SupplierAddress = _DebitNoteService.BMSUnit.SupplierRepository.GetByID(model.SupplierId).Address,
                        AttentionPerson = _DebitNoteService.BMSUnit.SupplierRepository.GetByID(model.SupplierId).Phone
                                          //LCNo=model.LCNo,
                                          //Total= model.tot`al

                                          //,IsActive = Convert.ToBoolean(model.IsActive)
                    };

                    return(PartialView("_Edit", viewModel));
                }
                else
                {
                    errorViewModel.ErrorMessage = CommonMessage.ErrorOccurred;
                    return(PartialView("_ErrorPopUp", errorViewModel));
                }
            }
            catch (Exception ex)
            {
                errorViewModel.ErrorMessage = CommonExceptionMessage.GetExceptionMessage(ex);
                return(PartialView("_ErrorPopUp", errorViewModel));
            }
        }
示例#5
0
        public DataSet BindAllDebitNoteDDL(DebitNoteModel objDNModel)
        {
            ///objDNModel.Ind = 11;

            DataSet dsDN = objDNDA.BindAllDebitNote(objDNModel);

            dsDN.Tables[0].TableName = "AccountHead";
            dsDN.Tables[1].TableName = "Narration";
            dsDN.Tables[2].TableName = "LastVoucherNo";
            dsDN.Tables[3].TableName = "ItemUnit";
            dsDN.Tables[4].TableName = "IssueReason";
            return(dsDN);
        }
示例#6
0
        public List <DebitNoteModel> GetDebitNotebyId(int id)
        {
            List <DebitNoteModel> lstDebit = new List <DebitNoteModel>();
            DebitNoteModel        objDebit;

            string Query = "SELECT * FROM Debit_Note WHERE Debit_Id=" + id;

            System.Data.IDataReader dr = _dbHelper.ExecuteDataReader(Query, _dbHelper.GetConnObject());

            while (dr.Read())
            {
                objDebit = new DebitNoteModel();

                objDebit.DN_Id          = DataFormat.GetInteger(dr["Debit_ID"]);
                objDebit.Voucher_Series = dr["Series"].ToString();
                objDebit.DN_Date        = DataFormat.GetDateTime(dr["DN_Date"]);
                objDebit.Voucher_Number = DataFormat.GetInteger(dr["VoucherNo"]);
                objDebit.Type           = dr["Type"].ToString();
                if (dr["PDC_Date"].ToString() != "")
                {
                    objDebit.PDCDate = Convert.ToDateTime(dr["PDC_Date"]);
                }

                //SELECT Contra Voucher Accounts

                string itemQuery = "SELECT * FROM Debit_Note_Accounts WHERE Debit_Id=" + objDebit.DN_Id;
                System.Data.IDataReader drAcc = _dbHelper.ExecuteDataReader(itemQuery, _dbHelper.GetConnObject());

                objDebit.DebitAccountModel = new List <AccountModel>();
                AccountModel objAcc;

                while (drAcc.Read())
                {
                    objAcc = new AccountModel();

                    objAcc.AC_Id     = DataFormat.GetInteger(drAcc["AC_Id"]);
                    objAcc.ParentId  = DataFormat.GetInteger(drAcc["Debit_Id"]);
                    objAcc.DC        = drAcc["DC"].ToString();
                    objAcc.Account   = drAcc["Account"].ToString();
                    objAcc.Debit     = Convert.ToDecimal(drAcc["Debit"]);
                    objAcc.Credit    = Convert.ToDecimal(drAcc["Credit"]);
                    objAcc.Narration = drAcc["Narration"].ToString();

                    objDebit.DebitAccountModel.Add(objAcc);
                }

                lstDebit.Add(objDebit);
            }
            return(lstDebit);
        }
示例#7
0
        // GET: Edit user
        public ActionResult EditDebitNote(int id = 0)
        {
            if (id == 0)
            {
                return(View());
            }
            else
            {
                //return RedirectToAction("AddEditViewDebit", "DebitNote", new { @id = id });
                using (DoorEntities db = new DoorEntities())
                {
                    temDebitData = db.Debit_Note.Where(x => x.id == id).FirstOrDefault <Debit_Note>();

                    Debit_Note     debitNote     = db.Debit_Note.Where(x => x.id == id).FirstOrDefault <Debit_Note>();
                    DebitNoteModel debitNoteData = new DebitNoteModel();

                    List <Debit_Product> DebitProduct = db.Debit_Product.Where(x => x.debit_id == id).ToList <Debit_Product>();
                    //static List<DebitNoteModel> debitPruductData = new List<DebitNoteModel>();

                    DebitNoteProductModel DebitNoteProduct = new DebitNoteProductModel();

                    debitNoteData.id               = debitNote.id;
                    debitNoteData.debit_id         = debitNote.debit_id;
                    debitNoteData.start_date       = debitNote.start_date;
                    debitNoteData.end_date         = debitNote.end_date;
                    debitNoteData.create_by        = debitNote.create_by;
                    debitNoteData.create_on        = debitNote.create_on;
                    debitNoteData.edit_by          = debitNote.edit_by;
                    debitNoteData.paying_date      = debitNote.paying_date;
                    debitNoteData.reference        = debitNote.reference;
                    debitNoteData.record_date      = debitNote.record_date;
                    debitNoteData.customer_name    = debitNote.customer_name;
                    debitNoteData.billing_to       = debitNote.billing_to;
                    debitNoteData.cust_address     = debitNote.cust_address;
                    debitNoteData.customer_phone   = debitNote.customer_phone;
                    debitNoteData.bl               = debitNote.bl;
                    debitNoteData.container_number = debitNote.container_number;
                    debitNoteData.commodity        = debitNote.commodity;
                    debitNoteData.package_number   = debitNote.package_number;
                    debitNoteData.vessel           = debitNote.vessel;
                    debitNoteData.voy              = debitNote.voy;
                    debitNoteData.advance_money    = debitNote.advance_money;

                    DebitNoteProduct.Debit_Note       = debitNoteData;
                    DebitNoteProduct.DebitProductList = DebitProduct;

                    return(View("Edit", DebitNoteProduct));
                }
            }
        }
示例#8
0
        internal DataTable SaveDebitNote(DebitNoteModel objDNModel)
        {
            try
            {
                ClsCon.cmd             = new SqlCommand();
                ClsCon.cmd.CommandType = CommandType.StoredProcedure;
                ClsCon.cmd.CommandText = "SPDebitNote";
                ClsCon.cmd.Parameters.AddWithValue("@Ind", objDNModel.Ind);
                ClsCon.cmd.Parameters.AddWithValue("@OrgID", objDNModel.OrgID);
                ClsCon.cmd.Parameters.AddWithValue("@BrID", objDNModel.BrID);
                ClsCon.cmd.Parameters.AddWithValue("@VchType", objDNModel.VchType);
                ClsCon.cmd.Parameters.AddWithValue("@DocDate", objDNModel.VoucherDate);
                ClsCon.cmd.Parameters.AddWithValue("@GSTOpted", objDNModel.GSTOpted);
                ClsCon.cmd.Parameters.AddWithValue("@DocDesc", objDNModel.DocDesc);
                ClsCon.cmd.Parameters.AddWithValue("@EntryType", objDNModel.EntryType);
                ClsCon.cmd.Parameters.AddWithValue("@User", objDNModel.User);
                ClsCon.cmd.Parameters.AddWithValue("@IP", objDNModel.IP);
                ClsCon.cmd.Parameters.AddWithValue("@YrCD", objDNModel.YrCD);
                ClsCon.cmd.Parameters.AddWithValue("@IssueReasonId", objDNModel.issueReasonId);
                ClsCon.cmd.Parameters.AddWithValue("@PreGstId", objDNModel.PreGstId);
                ClsCon.cmd.Parameters.AddWithValue("@CCCode", objDNModel.CCCode);
                ClsCon.cmd.Parameters.AddWithValue("@TblDebit", objDNModel.DtDebitNote);
                ClsCon.cmd.Parameters.AddWithValue("@TblItems", objDNModel.DtItems);

                con = ClsCon.SqlConn();
                ClsCon.cmd.Connection = con;
                dtDebitNote           = new DataTable();
                ClsCon.da             = new SqlDataAdapter(ClsCon.cmd);
                ClsCon.da.Fill(dtDebitNote);
                dtDebitNote.TableName = "success";
            }
            catch (Exception)
            {
                dtDebitNote           = new DataTable();
                dtDebitNote.TableName = "error";
                return(dtDebitNote);
            }
            finally
            {
                con.Close();
                con.Dispose();
                ClsCon.da.Dispose();
                ClsCon.cmd.Dispose();
            }
            return(dtDebitNote);
        }
示例#9
0
        public int SaveDebitNote(DebitNoteModel objdebit)
        {
            string Query   = string.Empty;
            int    debitId = 0;

            try
            {
                DBParameterCollection paramCollection = new DBParameterCollection();

                paramCollection.Add(new DBParameter("@Series", objdebit.Voucher_Series));
                paramCollection.Add(new DBParameter("@Date", objdebit.DN_Date));
                paramCollection.Add(new DBParameter("@Voucher_Number", objdebit.Voucher_Number));
                paramCollection.Add(new DBParameter("@Type", objdebit.Type));
                paramCollection.Add(new DBParameter("@PDDate", objdebit.PDCDate));
                paramCollection.Add(new DBParameter("@Long", objdebit.LongNarration));

                //paramCollection.Add(new DBParameter("@Party", objProd.Party));
                //paramCollection.Add(new DBParameter("@MatCenter", objProd.MatCenter));
                //paramCollection.Add(new DBParameter("@Narration", objProd.Narration));

                paramCollection.Add(new DBParameter("@CreatedBy", "Admin"));
                //paramCollection.Add(new DBParameter("@CreatedDate", DateTime.Now));


                Query = "INSERT INTO Debit_Note([Series],[DN_Date],[VoucherNo],[Type],[PDC_Date]," +
                        "[CreatedBy]) VALUES " +
                        "(@Series,@Date,@Voucher_Number,@Type,@PDDate, " +
                        " @CreatedBy)";

                if (_dbHelper.ExecuteNonQuery(Query, paramCollection) > 0)
                {
                    SaveDebitAccounts(objdebit.DebitAccountModel);
                    debitId = GetDebitId();
                }
            }
            catch (Exception ex)
            {
                debitId = 0;
                throw ex;
            }

            return(debitId);
        }
示例#10
0
        // GET: View user detail
        public ActionResult Create()
        {
            using (DoorEntities db = new DoorEntities())
            {
                DebitNoteModel debitNoteData = new DebitNoteModel();

                DebitNoteProductModel DebitNoteProduct = new DebitNoteProductModel();

                Debit_Note debit_last_data = getLastID();
                int        id    = debit_last_data.id + 1;
                string     id_st = "No2018-" + id;
                debitNoteData.debit_fullId = id_st;

                DebitNoteProduct.Debit_Note       = debitNoteData;
                DebitNoteProduct.DebitProductList = new List <Debit_Product>();

                return(View("Create", DebitNoteProduct));
            }
        }
        //internal DataTable AccountHead(CreditNoteModel objCNModel)
        //{
        //    try
        //    {
        //        ClsCon.cmd = new SqlCommand();
        //        ClsCon.cmd.CommandType = CommandType.StoredProcedure;
        //        ClsCon.cmd.CommandText = "SPMasters";
        //        ClsCon.cmd.Parameters.AddWithValue("@DataInd", objCNModel.Ind);
        //        ClsCon.cmd.Parameters.AddWithValue("@OrgID", objCNModel.OrgID);
        //        ClsCon.cmd.Parameters.AddWithValue("@BrID", objCNModel.BrID);
        //        ClsCon.cmd.Parameters.AddWithValue("@YrCD", objCNModel.YrCD);
        //        ClsCon.cmd.Parameters.AddWithValue("@VchType", objCNModel.VchType);

        //        con = ClsCon.SqlConn();
        //        ClsCon.cmd.Connection = con;
        //        dtCreditNote = new DataTable();
        //        ClsCon.da = new SqlDataAdapter(ClsCon.cmd);
        //        ClsCon.da.Fill(dtCreditNote);
        //        dtCreditNote.TableName = "success";
        //    }
        //    catch (Exception)
        //    {
        //        dtCreditNote = new DataTable();
        //        dtCreditNote.TableName = "error";
        //        return dtCreditNote;
        //    }
        //    finally
        //    {
        //        con.Close();
        //        con.Dispose();
        //        ClsCon.da.Dispose();
        //        ClsCon.cmd.Dispose();
        //    }
        //    return dtCreditNote;
        //}

        //internal DataTable LoadNarration(CreditNoteModel objCNModel)
        //{
        //    try
        //    {
        //        ClsCon.cmd = new SqlCommand();
        //        ClsCon.cmd.CommandType = CommandType.StoredProcedure;
        //        ClsCon.cmd.CommandText = "SPMasters";
        //        ClsCon.cmd.Parameters.AddWithValue("@DataInd", objCNModel.Ind);
        //        ClsCon.cmd.Parameters.AddWithValue("@OrgID", objCNModel.OrgID);
        //        ClsCon.cmd.Parameters.AddWithValue("@BrID", objCNModel.BrID);
        //        ClsCon.cmd.Parameters.AddWithValue("@YrCD", objCNModel.YrCD);
        //        ClsCon.cmd.Parameters.AddWithValue("@VchType", objCNModel.VchType);

        //        con = ClsCon.SqlConn();
        //        ClsCon.cmd.Connection = con;
        //        dtCreditNote = new DataTable();
        //        ClsCon.da = new SqlDataAdapter(ClsCon.cmd);
        //        ClsCon.da.Fill(dtCreditNote);
        //        dtCreditNote.TableName = "success";
        //    }
        //    catch (Exception)
        //    {
        //        dtCreditNote = new DataTable();
        //        dtCreditNote.TableName = "error";
        //        return dtCreditNote;
        //    }
        //    finally
        //    {
        //        con.Close();
        //        con.Dispose();
        //        ClsCon.da.Dispose();
        //        ClsCon.cmd.Dispose();
        //    }
        //    return dtCreditNote;
        //}
        //internal DataTable LastVoucherNo(CreditNoteModel objCNModel)
        //{
        //    try
        //    {
        //        ClsCon.cmd = new SqlCommand();
        //        ClsCon.cmd.CommandType = CommandType.StoredProcedure;
        //        ClsCon.cmd.CommandText = "SPMasters";
        //        ClsCon.cmd.Parameters.AddWithValue("@DataInd", objCNModel.Ind);
        //        ClsCon.cmd.Parameters.AddWithValue("@OrgID", objCNModel.OrgID);
        //        ClsCon.cmd.Parameters.AddWithValue("@BrID", objCNModel.BrID);
        //        ClsCon.cmd.Parameters.AddWithValue("@YrCD", objCNModel.YrCD);
        //        ClsCon.cmd.Parameters.AddWithValue("@VchType", objCNModel.VchType);

        //        con = ClsCon.SqlConn();
        //        ClsCon.cmd.Connection = con;
        //        dtCreditNote = new DataTable();
        //        ClsCon.da = new SqlDataAdapter(ClsCon.cmd);
        //        ClsCon.da.Fill(dtCreditNote);
        //        dtCreditNote.TableName = "success";
        //    }
        //    catch (Exception)
        //    {
        //        dtCreditNote = new DataTable();
        //        dtCreditNote.TableName = "error";
        //        return dtCreditNote;
        //    }
        //    finally
        //    {
        //        con.Close();
        //        con.Dispose();
        //        ClsCon.da.Dispose();
        //        ClsCon.cmd.Dispose();
        //    }
        //    return dtCreditNote;
        //}

        internal DataSet BindAllCreditNote(DebitNoteModel objDNModel)
        {
            try
            {
                ClsCon.cmd             = new SqlCommand();
                ClsCon.cmd.CommandType = CommandType.StoredProcedure;
                ClsCon.cmd.CommandText = "SPCreditNote";

                ClsCon.cmd.CommandType = CommandType.StoredProcedure;
                ClsCon.cmd.Parameters.AddWithValue("@Ind", objDNModel.Ind);
                ClsCon.cmd.Parameters.AddWithValue("@OrgID", objDNModel.OrgID);
                ClsCon.cmd.Parameters.AddWithValue("@BrID", objDNModel.BrID);
                ClsCon.cmd.Parameters.AddWithValue("@YrCD", objDNModel.YrCD);
                ClsCon.cmd.Parameters.AddWithValue("@VchType", objDNModel.VchType);

                con = ClsCon.SqlConn();
                ClsCon.cmd.Connection = con;
                DsCreditNote          = new DataSet();
                ClsCon.da             = new SqlDataAdapter(ClsCon.cmd);
                ClsCon.da.Fill(DsCreditNote);
                DsCreditNote.DataSetName         = "success";
                DsCreditNote.Tables[0].TableName = "AccountHead";
                DsCreditNote.Tables[1].TableName = "Narration";
                DsCreditNote.Tables[2].TableName = "LastVoucherNo";
                DsCreditNote.Tables[3].TableName = "ItemUnit";
                DsCreditNote.Tables[4].TableName = "IssueReason";
            }
            catch (Exception)
            {
                DsCreditNote             = new DataSet();
                DsCreditNote.DataSetName = "error";
                return(DsCreditNote);
            }
            finally
            {
                con.Close();
                con.Dispose();
                ClsCon.da.Dispose();
                ClsCon.cmd.Dispose();
            }
            return(DsCreditNote);
        }
        internal DataTable ItemsBinding(DebitNoteModel objDNModel)
        {
            try
            {
                ClsCon.cmd             = new SqlCommand();
                ClsCon.cmd.CommandType = CommandType.StoredProcedure;
                ClsCon.cmd.CommandText = "SPCreditNote";
                ClsCon.cmd.Parameters.AddWithValue("@Ind", objDNModel.Ind);
                ClsCon.cmd.Parameters.AddWithValue("@OrgID", objDNModel.OrgID);
                ClsCon.cmd.Parameters.AddWithValue("@BrID", objDNModel.BrID);
                ClsCon.cmd.Parameters.AddWithValue("@YrCD", objDNModel.YrCD);
                ClsCon.cmd.Parameters.AddWithValue("@PartyCode", objDNModel.PartyCode);
                ClsCon.cmd.Parameters.AddWithValue("@DocNo", objDNModel.InvoiceNo);
                ClsCon.cmd.Parameters.AddWithValue("@DocDate", objDNModel.InvoiceDate);


                ClsCon.cmd.Parameters.AddWithValue("@ByPurchaseSale", objDNModel.ByPurchaseSale);
                ClsCon.cmd.Parameters.AddWithValue("@VchType", objDNModel.VchType);

                con = ClsCon.SqlConn();
                ClsCon.cmd.Connection = con;
                dtCreditNote          = new DataTable();
                ClsCon.da             = new SqlDataAdapter(ClsCon.cmd);
                ClsCon.da.Fill(dtCreditNote);
                dtCreditNote.TableName = "success";
            }
            catch (Exception)
            {
                dtCreditNote           = new DataTable();
                dtCreditNote.TableName = "error";
                return(dtCreditNote);
            }
            finally
            {
                con.Close();
                con.Dispose();
                ClsCon.da.Dispose();
                ClsCon.cmd.Dispose();
            }
            return(dtCreditNote);
        }
示例#13
0
        public bool SaveDebitNote(DebitNoteModel objdebit)
        {
            string Query   = string.Empty;
            bool   isSaved = true;

            try
            {
                DBParameterCollection paramCollection = new DBParameterCollection();

                paramCollection.Add(new DBParameter("@VoucherNumber", objdebit.Voucher_Number));
                paramCollection.Add(new DBParameter("@Series", objdebit.Voucher_Series));
                paramCollection.Add(new DBParameter("@DNDate", objdebit.DN_Date, System.Data.DbType.DateTime));
                paramCollection.Add(new DBParameter("@DNType", objdebit.Type));
                paramCollection.Add(new DBParameter("@PDCDate", objdebit.PDC_Date, System.Data.DbType.DateTime));
                paramCollection.Add(new DBParameter("@LongNarration", objdebit.LongNarration));
                paramCollection.Add(new DBParameter("@TotalCreditAmount", objdebit.TotalCreditAmount, System.Data.DbType.Decimal));
                paramCollection.Add(new DBParameter("@TotalDebitAmount", objdebit.TotalDebitAmount, System.Data.DbType.Decimal));

                paramCollection.Add(new DBParameter("@CreatedBy", "Admin"));
                paramCollection.Add(new DBParameter("@CreatedDate", DateTime.Now, System.Data.DbType.DateTime));
                paramCollection.Add(new DBParameter("@ModifiedBy", ""));
                paramCollection.Add(new DBParameter("@ModifiedDate", DateTime.Now, System.Data.DbType.DateTime));

                System.Data.IDataReader dr =
                    _dbHelper.ExecuteDataReader("spInsertDebitNoteMaster", _dbHelper.GetConnObject(), paramCollection, System.Data.CommandType.StoredProcedure);

                int id = 0;
                dr.Read();
                id = Convert.ToInt32(dr[0]);
                SaveDebitAccounts(objdebit.DebitAccountModel, id);
            }
            catch (Exception ex)
            {
                isSaved = false;
                throw ex;
            }

            return(isSaved);
        }
示例#14
0
        public ActionResult Edit(DebitNoteModel viewModel)
        {
            var strMessage = string.Empty;

            try
            {
                if (ModelState.IsValid)
                {
                    var model = _DebitNoteService.BMSUnit.DebitNoteRepository.GetByID(viewModel.Id);

                    #region Current User

                    viewModel.IUser = model.IUser;
                    viewModel.IDate = model.IDate;

                    var userName = HttpContext.User.Identity.Name;
                    viewModel.EUser = userName;
                    viewModel.EDate = DateTime.Now;

                    #endregion

                    var entity = viewModel.ToEntity();

                    _DebitNoteService.BMSUnit.DebitNoteRepository.Update(entity);
                    _DebitNoteService.BMSUnit.DebitNoteRepository.SaveChanges();

                    return(Content(Boolean.TrueString));
                }

                strMessage = Common.GetModelStateErrorMessage(ModelState);
            }
            catch (Exception ex)
            {
                strMessage = CommonExceptionMessage.GetExceptionMessage(ex, CommonAction.Update);
            }

            return(Content(strMessage));
        }
示例#15
0
        internal DataSet BindAllDebitNote(DebitNoteModel objDNModel)
        {
            try
            {
                ClsCon.cmd             = new SqlCommand();
                ClsCon.cmd.CommandType = CommandType.StoredProcedure;
                ClsCon.cmd.CommandText = "SPDebitNote";

                ClsCon.cmd.CommandType = CommandType.StoredProcedure;
                ClsCon.cmd.Parameters.AddWithValue("@Ind", objDNModel.Ind);
                ClsCon.cmd.Parameters.AddWithValue("@OrgID", objDNModel.OrgID);
                ClsCon.cmd.Parameters.AddWithValue("@BrID", objDNModel.BrID);
                ClsCon.cmd.Parameters.AddWithValue("@YrCD", objDNModel.YrCD);
                ClsCon.cmd.Parameters.AddWithValue("@VchType", objDNModel.VchType);

                con = ClsCon.SqlConn();
                ClsCon.cmd.Connection = con;
                dsDebitNote           = new DataSet();
                ClsCon.da             = new SqlDataAdapter(ClsCon.cmd);
                ClsCon.da.Fill(dsDebitNote);
                dsDebitNote.DataSetName = "success";
            }
            catch (Exception)
            {
                dsDebitNote             = new DataSet();
                dsDebitNote.DataSetName = "error";
                return(dsDebitNote);
            }
            finally
            {
                con.Close();
                con.Dispose();
                ClsCon.da.Dispose();
                ClsCon.cmd.Dispose();
            }
            return(dsDebitNote);
        }
        internal DataTable CancelVoucher(DebitNoteModel objDNModel)
        {
            try
            {
                ClsCon.cmd             = new SqlCommand();
                ClsCon.cmd.CommandType = CommandType.StoredProcedure;
                ClsCon.cmd.CommandText = "SPDebitNote";

                ClsCon.cmd.CommandType = CommandType.StoredProcedure;
                ClsCon.cmd.Parameters.AddWithValue("@Ind", objDNModel.Ind);
                ClsCon.cmd.Parameters.AddWithValue("@OrgID", objDNModel.OrgID);
                ClsCon.cmd.Parameters.AddWithValue("@BrID", objDNModel.BrID);
                ClsCon.cmd.Parameters.AddWithValue("@DocNo", objDNModel.VoucherNo);
                ClsCon.cmd.Parameters.AddWithValue("@VchType", objDNModel.VchType);
                ClsCon.cmd.Parameters.AddWithValue("@CancelReason", objDNModel.CancelReason);
                con = ClsCon.SqlConn();
                ClsCon.cmd.Connection = con;
                dtCancel  = new DataTable();
                ClsCon.da = new SqlDataAdapter(ClsCon.cmd);
                ClsCon.da.Fill(dtCancel);
                dtCancel.TableName = "success";
            }
            catch (Exception)
            {
                dtCancel           = new DataTable();
                dtCancel.TableName = "error";
                return(dtCancel);
            }
            finally
            {
                con.Close();
                con.Dispose();
                ClsCon.da.Dispose();
                ClsCon.cmd.Dispose();
            }
            return(dtCancel);
        }
示例#17
0
        public JsonResult SetDebitNoteDetailsListForSave(List <DebitNoteDetailViewModel> lstDebitNoteDetails)
        {
            var strMessage = string.Empty;

            // Clear detail list
            Session["lstDebitNoteDetails"] = null;

            try
            {
                List <DebitNoteDetailModel> list = new List <DebitNoteDetailModel>();
                var invoiceModel = new DebitNoteModel();

                // Add new detail information
                foreach (var item in lstDebitNoteDetails)
                {
                    DebitNoteDetailModel entityModel = new DebitNoteDetailModel();

                    //entityModel.DebitNoteId = item.DebitNoteId;
                    //entityModel.ProductId = item.ProductId;
                    //entityModel.UnitPrice = Convert.ToDecimal(item.UnitPrice);
                    //entityModel.Quantity = Convert.ToDecimal(item.Quantity);
                    //entityModel.SubTotal = entityModel.UnitPrice * Convert.ToDecimal(item.Quantity);
                    list.Add(entityModel);
                }

                Session["lstDebitNoteDetails"] = list;
                return(Json(invoiceModel, JsonRequestBehavior.AllowGet));
                //strMessage = Boolean.TrueString;
            }
            catch (Exception ex)
            {
                strMessage = CommonExceptionMessage.GetExceptionMessage(ex, CommonAction.Save);
            }

            return(Json(new { strMessage = strMessage }));
        }
示例#18
0
        internal DataTable LoadPartyAccount(DebitNoteModel objDNModel)
        {
            try
            {
                ClsCon.cmd             = new SqlCommand();
                ClsCon.cmd.CommandType = CommandType.StoredProcedure;
                ClsCon.cmd.CommandText = "SPMasters";

                ClsCon.cmd.CommandType = CommandType.StoredProcedure;
                ClsCon.cmd.Parameters.AddWithValue("@DataInd", objDNModel.Ind);
                ClsCon.cmd.Parameters.AddWithValue("@OrgID", objDNModel.OrgID);
                ClsCon.cmd.Parameters.AddWithValue("@BrID", objDNModel.BrID);
                ClsCon.cmd.Parameters.AddWithValue("@YrCD", objDNModel.YrCD);

                con = ClsCon.SqlConn();
                ClsCon.cmd.Connection = con;
                dtDebitNote           = new DataTable();
                ClsCon.da             = new SqlDataAdapter(ClsCon.cmd);
                ClsCon.da.Fill(dtDebitNote);
                dtDebitNote.TableName = "success";
            }
            catch (Exception)
            {
                dtDebitNote           = new DataTable();
                dtDebitNote.TableName = "error";
                return(dtDebitNote);
            }
            finally
            {
                con.Close();
                con.Dispose();
                ClsCon.da.Dispose();
                ClsCon.cmd.Dispose();
            }
            return(dtDebitNote);
        }
示例#19
0
        public DataTable FillGistnNo(DebitNoteModel objDNModel)
        {
            DataTable dtNarration = objDNDA.FillGistnNo(objDNModel);

            return(dtNarration);
        }
示例#20
0
        //UPDATE Debit NOTE
        public bool UpdateDebitNote(DebitNoteModel objDebit)
        {
            string Query     = string.Empty;
            bool   isUpdated = true;

            try
            {
                //UPDATE CREDIT NOTE TABLE - PARENT TABLE

                DBParameterCollection paramCollection = new DBParameterCollection();

                paramCollection.Add(new DBParameter("@Series", objDebit.Voucher_Series));
                paramCollection.Add(new DBParameter("@Date", objDebit.DN_Date));
                paramCollection.Add(new DBParameter("@Voucher_Number", objDebit.Voucher_Number));
                paramCollection.Add(new DBParameter("@Type", objDebit.Type));
                paramCollection.Add(new DBParameter("@PDDate", objDebit.PDCDate));
                //paramCollection.Add(new DBParameter("@TotalCreditAmt", "0"));
                //paramCollection.Add(new DBParameter("@TotalDebitAmt", "0"));

                paramCollection.Add(new DBParameter("@ModifiedBy", "Admin"));
                paramCollection.Add(new DBParameter("@ModifiedDate", DateTime.Now));
                paramCollection.Add(new DBParameter("@id", objDebit.DN_Id));

                Query = "UPDATE Debit_Note SET [Series]=@Series,[DN_Date]=@Date,[VoucherNo]=@Voucher_Number," +
                        "[Type]=@Type,[PDC_Date]=@PDDate,[ModifiedBy]=@ModifiedBy," +
                        "[ModifiedDate]=@ModifiedDate " +
                        "WHERE Debit_Id=@id";

                if (_dbHelper.ExecuteNonQuery(Query, paramCollection) > 0)
                {
                    List <AccountModel> lstAcct = new List <AccountModel>();

                    //UPDATE CREDIT NOTE ACCOUNT -CHILD TABLE UPDATES
                    foreach (AccountModel act in objDebit.DebitAccountModel)
                    {
                        if (act.AC_Id > 0)
                        {
                            paramCollection = new DBParameterCollection();

                            paramCollection.Add(new DBParameter("@DC", (act.DC)));
                            paramCollection.Add(new DBParameter("@Account", act.Account));
                            paramCollection.Add(new DBParameter("@Debit", act.Debit));
                            paramCollection.Add(new DBParameter("@Credit", act.Credit));
                            paramCollection.Add(new DBParameter("@Narration", act.Narration));

                            paramCollection.Add(new DBParameter("@ModifiedBy", "Admin"));
                            paramCollection.Add(new DBParameter("@ModifiedDate", DateTime.Now));
                            paramCollection.Add(new DBParameter("@ACT_ID", act.AC_Id));

                            Query = "UPDATE Debit_Note_Accounts SET [DC]=@DC," +
                                    "[Account]=@Account,[Debit]=@Debit,[Credit]=@Credit,[Narration]=@Narration,[ModifiedBy]=@ModifiedBy,[ModifiedDate]=@ModifiedDate " +
                                    "WHERE [AC_Id]=@ACT_ID";

                            if (_dbHelper.ExecuteNonQuery(Query, paramCollection) > 0)
                            {
                                isUpdated = true;
                            }
                        }
                        else
                        {
                            paramCollection = new DBParameterCollection();

                            paramCollection.Add(new DBParameter("@DN_ID", (act.ParentId)));
                            paramCollection.Add(new DBParameter("@DC", (act.DC)));
                            paramCollection.Add(new DBParameter("@Account", act.Account));
                            paramCollection.Add(new DBParameter("@Debit", act.Debit));
                            paramCollection.Add(new DBParameter("@Credit", act.Credit));
                            paramCollection.Add(new DBParameter("@Narration", act.Narration));

                            paramCollection.Add(new DBParameter("@CreatedBy", "Admin"));
                            paramCollection.Add(new DBParameter("@CreatedDate", DateTime.Now));


                            Query = "INSERT INTO Debit_Note_Accounts([Debit_Id],[DC],[Account],[Debit],[Credit]," +
                                    "[Narration],[CreatedBy],[CreatedDate]) VALUES " +
                                    "(@DN_ID,@DC,@Account,@Debit,@Credit,@Narration,@CreatedBy,@CreatedDate)";

                            if (_dbHelper.ExecuteNonQuery(Query, paramCollection) > 0)
                            {
                            }
                            ;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                isUpdated = false;
                throw ex;
            }

            return(isUpdated);
        }
示例#21
0
        //UPDATE Debit NOTE
        public bool UpdateDebitNote(DebitNoteModel objdebit)
        {
            string Query     = string.Empty;
            bool   isUpdated = true;

            try
            {
                //UPDATE Debit NOTE TABLE - PARENT TABLE
                DBParameterCollection paramCollection = new DBParameterCollection();

                paramCollection.Add(new DBParameter("@VoucherNumber", objdebit.Voucher_Number));
                paramCollection.Add(new DBParameter("@Series", objdebit.Voucher_Series));
                paramCollection.Add(new DBParameter("@DNDate", objdebit.DN_Date, System.Data.DbType.DateTime));
                paramCollection.Add(new DBParameter("@DNType", objdebit.Type));
                paramCollection.Add(new DBParameter("@PDCDate", objdebit.PDC_Date, System.Data.DbType.DateTime));
                paramCollection.Add(new DBParameter("@LongNarration", objdebit.LongNarration));
                paramCollection.Add(new DBParameter("@TotalCreditAmount", objdebit.TotalCreditAmount, System.Data.DbType.Decimal));
                paramCollection.Add(new DBParameter("@TotalDebitAmount", objdebit.TotalDebitAmount, System.Data.DbType.Decimal));

                paramCollection.Add(new DBParameter("@CreatedBy", "Admin"));
                paramCollection.Add(new DBParameter("@CreatedDate", DateTime.Now, System.Data.DbType.DateTime));
                paramCollection.Add(new DBParameter("@ModifiedBy", ""));
                paramCollection.Add(new DBParameter("@ModifiedDate", DateTime.Now, System.Data.DbType.DateTime));
                paramCollection.Add(new DBParameter("@ParentId", objdebit.DN_Id));

                System.Data.IDataReader dr =
                    _dbHelper.ExecuteDataReader("spUpdateDebitNoteMaster", _dbHelper.GetConnObject(), paramCollection, System.Data.CommandType.StoredProcedure);

                List <AccountModel> lstAcct = new List <AccountModel>();

                //UPDATE CREDIT NOTE ACCOUNT -CHILD TABLE UPDATES
                foreach (AccountModel Acc in objdebit.DebitAccountModel)
                {
                    Acc.ParentId = objdebit.DN_Id;
                    if (Acc.AC_Id > 0)
                    {
                        paramCollection = new DBParameterCollection();

                        paramCollection.Add(new DBParameter("@ParentId", (Acc.ParentId)));
                        paramCollection.Add(new DBParameter("@DC", (Acc.DC)));
                        paramCollection.Add(new DBParameter("@Account", Acc.Account));
                        paramCollection.Add(new DBParameter("@LedgerId", Acc.LedgerId));
                        paramCollection.Add(new DBParameter("@DebitAmount", Acc.Debit, System.Data.DbType.Decimal));
                        paramCollection.Add(new DBParameter("@CreditAmount", Acc.Credit, System.Data.DbType.Decimal));
                        paramCollection.Add(new DBParameter("@Narration", Acc.Narration));

                        paramCollection.Add(new DBParameter("@CreatedBy", "Admin"));
                        paramCollection.Add(new DBParameter("@CreatedDate", DateTime.Now, System.Data.DbType.DateTime));
                        paramCollection.Add(new DBParameter("@ModifiedBy", ""));
                        paramCollection.Add(new DBParameter("@ModifiedDate", DateTime.Now, System.Data.DbType.DateTime));
                        paramCollection.Add(new DBParameter("@ACTID", Acc.AC_Id));

                        System.Data.IDataReader drD =
                            _dbHelper.ExecuteDataReader("spUpdateDebitDetails", _dbHelper.GetConnObject(), paramCollection, System.Data.CommandType.StoredProcedure);

                        isUpdated = true;
                    }
                    else
                    {
                        paramCollection = new DBParameterCollection();

                        paramCollection.Add(new DBParameter("@DebitId", (Acc.ParentId)));
                        paramCollection.Add(new DBParameter("@DC", (Acc.DC)));
                        paramCollection.Add(new DBParameter("@Account", Acc.Account));
                        paramCollection.Add(new DBParameter("@LedgerId", Acc.LedgerId));
                        paramCollection.Add(new DBParameter("@DebitAmount", Acc.Debit, System.Data.DbType.Decimal));
                        paramCollection.Add(new DBParameter("@CreditAmount", Acc.Credit, System.Data.DbType.Decimal));
                        paramCollection.Add(new DBParameter("@Narration", Acc.Narration));

                        paramCollection.Add(new DBParameter("@CreatedBy", "Admin"));
                        paramCollection.Add(new DBParameter("@CreatedDate", DateTime.Now, System.Data.DbType.DateTime));
                        paramCollection.Add(new DBParameter("@ModifiedBy", ""));
                        paramCollection.Add(new DBParameter("@ModifiedDate", DateTime.Now, System.Data.DbType.DateTime));

                        System.Data.IDataReader drD =
                            _dbHelper.ExecuteDataReader("spInsertDebitDetails", _dbHelper.GetConnObject(), paramCollection, System.Data.CommandType.StoredProcedure);
                    }
                }
            }
            catch (Exception ex)
            {
                isUpdated = false;
                //  throw ex;
            }

            return(isUpdated);
        }
        public DataTable CancelVoucher(DebitNoteModel objDNModel)
        {
            DataTable dtCancel = objUpdDebitNoteDA.CancelVoucher(objDNModel);

            return(dtCancel);
        }
        public DataSet BindAllCreditNoteDDL(DebitNoteModel objDNModel)
        {
            DataSet dsCN = objCNDA.BindAllCreditNote(objDNModel);

            return(dsCN);
        }
        public DataTable ItemsBinding(DebitNoteModel objDNModel)
        {
            DataTable dtItemsBinding = objCNDA.ItemsBinding(objDNModel);

            return(dtItemsBinding);
        }
示例#25
0
 public static tblDebitNote ToEntity(this DebitNoteModel model)
 {
     return(Mapper.Map <DebitNoteModel, tblDebitNote>(model));
 }
示例#26
0
        public DataTable SaveDebitNote(DebitNoteModel objDNModel)
        {
            DataTable dtNarration = objDNDA.SaveDebitNote(objDNModel);

            return(dtNarration);
        }
示例#27
0
        public ActionResult Create(DebitNoteModel viewModel)
        {
            var strMessage = string.Empty;

            try
            {
                if (ModelState.IsValid)
                {
                    #region Current User

                    var userName = HttpContext.User.Identity.Name;
                    viewModel.IUser = userName;
                    viewModel.IDate = DateTime.Now;
                    viewModel.EDate = DateTime.Now;
                    #endregion

                    #region Releated Data
                    //viewModel.DebitNoteNo = "123";
                    //var PSavedGRlist = _DebitNoteService.GenerateCustomDebitNoteId().ToList();
                    //viewModel.DebitNoteNo = PSavedGRlist.FirstOrDefault().DebitNoteId;
                    #endregion

                    List <DebitNoteDetailModel> list = new List <DebitNoteDetailModel>();
                    if (Session["lstDebitNoteDetails"] != null)
                    {
                        list = (List <DebitNoteDetailModel>)Session["lstDebitNoteDetails"];
                    }

                    var entity = viewModel.ToEntity();

                    _DebitNoteService.BMSUnit.DebitNoteRepository.Add(entity);
                    _DebitNoteService.BMSUnit.DebitNoteRepository.SaveChanges();

                    Session["DebitNoteMasterId"] = entity.Id;

                    #region Save DebitNote Detail

                    if (list != null && list.Count > 0)
                    {
                        //foreach (DebitNoteDetailViewModel detail in list)
                        foreach (DebitNoteDetailModel detail in list)
                        {
                            detail.DebitNoteId = Convert.ToInt32(entity.Id);
                            var detailEntity = detail.ToEntity();
                            _DebitNoteService.BMSUnit.DebitNoteDetailRepository.Add(detailEntity);
                            _DebitNoteService.BMSUnit.DebitNoteDetailRepository.SaveChanges();
                        }
                    }

                    Session["lstDebitNoteDetails"] = null;

                    #endregion
                    return(Content(Boolean.TrueString));
                }

                strMessage = Common.GetModelStateErrorMessage(ModelState);
            }
            catch (Exception ex)
            {
                strMessage = CommonExceptionMessage.GetExceptionMessage(ex, CommonAction.Save);
            }

            return(Content(strMessage));
        }
示例#28
0
        public DataTable LoadPartyAccount(DebitNoteModel objDNModel)
        {
            DataTable dtPartyAccount = objDNDA.LoadPartyAccount(objDNModel);

            return(dtPartyAccount);
        }