示例#1
0
 private OutputMessage UpdateVoucher()
 {
     try
     {
         OutputMessage result = null;
         Entities.Finance.VoucherEntry Voucher = new Entities.Finance.VoucherEntry();
         Voucher.CreatedBy = CPublic.GetuserID();
         DataSet dsTemp = new DataSet();
         if (ViewState["DSTemp"] != null)
         {
             dsTemp = (DataSet)ViewState["DSTemp"];
         }
         if (dsTemp != null && dsTemp.Tables[0].Rows.Count > 0)
         {
             DataRow row;
             Voucher.DeleteVoucher(Convert.ToInt32(hdItemId.Value));
             for (int i = 0; i < dsTemp.Tables[0].Rows.Count; i++)
             {
                 Voucher.Frm_TransID     = 0;
                 Voucher.ToTransID       = 0;
                 Voucher.FrmTransChildID = 0;
                 Voucher.ToTransChildID  = 0;
                 row = dsTemp.Tables[0].Rows[i];
                 if (Convert.ToString(row["CreditOrDebit"]) != "")
                 {
                     Voucher.VoucherType = Convert.ToString(row["CreditOrDebit"]);
                 }
                 if (Convert.ToString(row["ParticularsID"]) != "")
                 {
                     if (Voucher.VoucherType == "0")
                     {
                         Voucher.Frm_TransID = Convert.ToInt32(row["ParticularsID"]);
                     }
                     else
                     {
                         Voucher.ToTransID = Convert.ToInt32(row["ParticularsID"]);
                     }
                 }
                 if (Convert.ToString(row["CostHead"]) != "")    //row["CostHead"]
                 {
                     if (Voucher.VoucherType == "0")
                     {
                         if (Voucher.Frm_TransID != 0)
                         {
                             Voucher.FrmTransChildID = Convert.ToInt32(row["CostHead"]);
                         }
                         else
                         {
                             //Voucher.FrmTransChildID == 0 ? null : Convert.ToInt32(row["CostHead"]);
                         }
                     }
                     else
                     {
                         Voucher.ToTransChildID = Convert.ToInt32(row["CostHead"]);
                     }
                 }
                 if (Convert.ToString(row["Amount"]) != "")
                 {
                     Voucher.AmountNew = Convert.ToDecimal(row["Amount"]);
                 }
                 if (Convert.ToString(row["CostCenter"]) != "")
                 {
                     Voucher.CostCenter = Convert.ToString(row["CostCenter"]);
                 }
                 Voucher.Date          = Convert.ToDateTime(txtDate.Text); //DateTime.Now.ToString();
                 Voucher.username      = Convert.ToString(Session["UserName"]);
                 Voucher.Description   = txtnarration.Text;
                 Voucher.IsCheque      = 0;
                 Voucher.ChequeNo      = "";
                 Voucher.ChequeDate    = null;
                 Voucher.IsVoucher     = 1;
                 Voucher.VoucherTypeID = Convert.ToInt32(ddlVoucherType.SelectedValue);
                 if (txtNumber.ReadOnly == true)
                 {
                     if (txtNumber.Text.Trim() == "")
                     {
                         Voucher.VoucherNo = 0;
                     }
                     else
                     {
                         Voucher.VoucherNo = Convert.ToInt32(txtNumber.Text);
                     }
                 }
                 Voucher.groupID = Convert.ToInt32(hdItemId.Value);
                 result          = Voucher.Save();
                 //hdnGroupID.Value = Convert.ToString(result.Object);
             }
         }
         return(result);
     }
     catch (Exception ex)
     {
         return(null);
     }
 }
示例#2
0
        private OutputMessage SaveExpenseEntry()
        {
            try
            {
                Entities.Finance.VoucherEntry Expense = new Entities.Finance.VoucherEntry();
                DataSet       dsTemp     = new DataSet();
                StringBuilder StrVType   = new StringBuilder();
                StringBuilder StrAccID   = new StringBuilder();
                StringBuilder StrChdID   = new StringBuilder();
                StringBuilder StrAmount  = new StringBuilder();
                StringBuilder StrCostCtr = new StringBuilder();
                Expense.CreatedBy = CPublic.GetuserID();
                if (ViewState["DSTemp"] != null)
                {
                    dsTemp = (DataSet)ViewState["DSTemp"];
                }
                if (dsTemp != null && dsTemp.Tables[0].Rows.Count > 0)
                {
                    DataRow row;
                    for (int i = 0; i < dsTemp.Tables[0].Rows.Count; i++)
                    {
                        row = dsTemp.Tables[0].Rows[i];
                        if (Convert.ToString(row["CreditOrDebit"]) != "")
                        {
                            if (StrVType.ToString() == "")
                            {
                                StrVType.Append(Convert.ToString(row["CreditOrDebit"]));
                            }
                            else
                            {
                                StrVType.Append("|" + Convert.ToString(row["CreditOrDebit"]));
                            }
                        }
                        if (Convert.ToString(row["ParticularsID"]) != "")
                        {
                            if (StrAccID.ToString() == "")
                            {
                                StrAccID.Append(Convert.ToString(row["ParticularsID"]));
                            }
                            else
                            {
                                StrAccID.Append("|" + Convert.ToString(row["ParticularsID"]));
                            }
                        }


                        if (Convert.ToString(row["CostHead"]) != "")
                        {
                            if (StrChdID.ToString() == "")
                            {
                                StrChdID.Append(Convert.ToString(row["CostHead"]));
                            }
                            else
                            {
                                StrChdID.Append("|" + Convert.ToString(row["CostHead"]));
                            }
                        }

                        if (Convert.ToString(row["Amount"]) != "")
                        {
                            if (StrAmount.ToString() == "")
                            {
                                StrAmount.Append(Convert.ToString(row["Amount"]));
                            }
                            else
                            {
                                StrAmount.Append("|" + Convert.ToString(row["Amount"]));
                            }
                        }
                        if (Convert.ToString(row["CostCenter"]) != "")
                        {
                            if (StrCostCtr.ToString() == "")
                            {
                                StrCostCtr.Append(Convert.ToString(row["CostCenter"]));
                            }
                            else
                            {
                                StrCostCtr.Append("|" + Convert.ToString(row["CostCenter"]));
                            }
                        }
                    }
                }
                Expense.Date        = DateTime.Now;
                Expense.username    = Convert.ToString(Session["UserName"]);
                Expense.Description = txtnarration.Text;

                Expense.IsCheque   = 0;
                Expense.ChequeNo   = "";
                Expense.ChequeDate = DateTime.MinValue;
                if (txtNumber.ReadOnly == true)
                {
                    if (txtNumber.Text.Trim() == "")
                    {
                        Expense.VoucherNo = 0;
                    }
                    else
                    {
                        Expense.VoucherNo = Convert.ToInt32(txtNumber.Text);
                    }
                }
                Expense.VoucherTypeID = Convert.ToInt32(ddlVoucherType.SelectedValue);
                Expense.VoucherType   = StrVType.ToString();
                Expense.AccountHead   = StrAccID.ToString();
                Expense.AccountChild  = StrChdID.ToString();
                Expense.Amount        = StrAmount.ToString();
                Expense.CostCenter    = StrCostCtr.ToString();
                DataSet       dsVoucherEntryDet = new DataSet();
                OutputMessage Result            = null;
                Result = Expense.Save(StrVType.ToString(), StrAccID.ToString(), StrChdID.ToString(), StrAmount.ToString(), StrCostCtr.ToString(), "", "");
                return(Result);
            }
            catch (Exception)
            {
                return(null);
            }
        }
示例#3
0
        private OutputMessage SaveVoucherEntry()
        {
            try
            {
                OutputMessage result = null;
                Entities.Finance.VoucherEntry Voucher = new Entities.Finance.VoucherEntry();
                Voucher.CreatedBy = CPublic.GetuserID();
                DataSet       dsTemp     = new DataSet();
                StringBuilder StrVType   = new StringBuilder();
                StringBuilder StrAccID   = new StringBuilder();
                StringBuilder StrChdID   = new StringBuilder();
                StringBuilder StrAmount  = new StringBuilder();
                StringBuilder StrCostCtr = new StringBuilder();
                if (ViewState["DSTemp"] != null)
                {
                    dsTemp = (DataSet)ViewState["DSTemp"];
                }
                if (dsTemp != null && dsTemp.Tables[0].Rows.Count > 0)
                {
                    DataRow row;
                    for (int i = 0; i < dsTemp.Tables[0].Rows.Count; i++)
                    {
                        row = dsTemp.Tables[0].Rows[i];
                        if (Convert.ToString(row["CreditOrDebit"]) != "")
                        {
                            if (StrVType.ToString() == "")
                            {
                                StrVType.Append(Convert.ToString(row["CreditOrDebit"]));
                            }
                            else
                            {
                                StrVType.Append("|" + Convert.ToString(row["CreditOrDebit"]));
                            }
                        }
                        if (Convert.ToString(row["ParticularsID"]) != "")
                        {
                            if (StrAccID.ToString() == "")
                            {
                                StrAccID.Append(Convert.ToString(row["ParticularsID"]));
                            }
                            else
                            {
                                StrAccID.Append("|" + Convert.ToString(row["ParticularsID"]));
                            }
                        }
                        if (Convert.ToString(row["CostHead"]) != "")
                        {
                            if (StrChdID.ToString() == "")
                            {
                                StrChdID.Append(Convert.ToString(row["CostHead"]));
                            }
                            else
                            {
                                StrChdID.Append("|" + Convert.ToString(row["CostHead"]));
                            }
                        }
                        if (Convert.ToString(row["Amount"]) != "")
                        {
                            if (StrAmount.ToString() == "")
                            {
                                StrAmount.Append(Convert.ToString(row["Amount"]));
                            }
                            else
                            {
                                StrAmount.Append("|" + Convert.ToString(row["Amount"]));
                            }
                        }
                        if (Convert.ToString(row["CostCenter"]) != "")
                        {
                            if (StrCostCtr.ToString() == "")
                            {
                                StrCostCtr.Append(Convert.ToString(row["CostCenter"]));
                            }
                            else
                            {
                                StrCostCtr.Append("|" + Convert.ToString(row["CostCenter"]));
                            }
                        }
                    }
                }
                //string Vtype = "", StrAccID="", StrChdID="", StrAmount="", StrCostCtr="";
                //if (ViewState["DSTemp"] != null)
                //{
                //    dsTemp = (DataSet)ViewState["DSTemp"];
                //}
                //if (dsTemp != null && dsTemp.Tables[0].Rows.Count > 0)
                //{
                //    DataRow row;
                //    for (int i = 0; i < dsTemp.Tables[0].Rows.Count; i++)
                //    {
                //        Voucher.Frm_TransID = 0;
                //        Voucher.ToTransID = 0;
                //        Voucher.FrmTransChildID = 0;
                //        Voucher.ToTransChildID = 0;
                //        row = dsTemp.Tables[0].Rows[i];
                //        //if (Convert.ToString(row["CreditOrDebit"]) != "")
                //        //{
                //        //    //Voucher.VoucherType = Convert.ToString(row["CreditOrDebit"]);
                //        //    Vtype += Convert.ToString(row["CreditOrDebit"]) + "|";
                //        //}
                //        //if (Convert.ToString(row["ParticularsID"]) != "")
                //        //{

                //        //    StrAccID += Convert.ToInt32(row["ParticularsID"]) + "|";
                //        //    //if (Voucher.VoucherType=="1")
                //        //    //{

                //        //    //    //Voucher.Frm_TransID = Convert.ToInt32(row["ParticularsID"]);
                //        //    //}
                //        //    //else
                //        //    //{
                //        //    //    StrAccID += Convert.ToInt32(row["ParticularsID"]) + "|";
                //        //    //    Voucher.ToTransID = Convert.ToInt32(row["ParticularsID"]);
                //        //    //}
                //        //}
                //        if (Convert.ToString(row["CostHead"]) != ""||Convert.ToString(row["CostHead"])!="0")    //row["CostHead"]
                //        {
                //            if (Voucher.VoucherType == "0")
                //            {
                //                if (Voucher.Frm_TransID!=0)
                //                {
                //                     Voucher.FrmTransChildID = Convert.ToInt32(row["CostHead"]);
                //                }
                //                else
                //                {
                //                    //Voucher.FrmTransChildID == 0 ? null : Convert.ToInt32(row["CostHead"]);
                //                }
                //            }
                //            else
                //            {
                //                Voucher.ToTransChildID = Convert.ToInt32(row["CostHead"]);
                //            }
                //        }
                //        if (Convert.ToString(row["Amount"]) != "")
                //        {
                //            Voucher.AmountNew = Convert.ToDecimal(row["Amount"]);
                //        }
                //        if (Convert.ToString(row["CostCenter"]) != "")
                //        {
                //            Voucher.CostCenter = Convert.ToString(row["CostCenter"]);
                //        }
                Voucher.Date          = Convert.ToDateTime(txtDate.Text); //DateTime.Now.ToString();
                Voucher.username      = Convert.ToString(Session["UserName"]);
                Voucher.Description   = txtnarration.Text;
                Voucher.IsCheque      = 0;
                Voucher.ChequeNo      = "";
                Voucher.ChequeDate    = null;
                Voucher.IsVoucher     = 1;
                Voucher.VoucherTypeID = Convert.ToInt32(ddlVoucherType.SelectedValue);
                if (txtNumber.ReadOnly == true)
                {
                    if (txtNumber.Text.Trim() == "")
                    {
                        Voucher.VoucherNo = 0;
                    }
                    else
                    {
                        Voucher.VoucherNo = Convert.ToInt32(txtNumber.Text);
                    }
                }
                //        Voucher.groupID = Convert.ToInt32(hdnGroupID.Value);
                //    }
                result = Voucher.Save(Convert.ToString(StrVType), Convert.ToString(StrAccID), Convert.ToString(StrChdID), Convert.ToString(StrAmount), Convert.ToString(StrCostCtr), "", "");
                //    hdnGroupID.Value = Convert.ToString(result.Object);
                //}
                return(result);
            }
            catch (Exception ex)
            {
                return(null);
            }
        }