Exemplo n.º 1
0
 protected void btnDelete_Click(object sender, ImageClickEventArgs e)
 {
     try
     {
         ImageButton imgdelete = (ImageButton)sender;
         PettyCash   chkeEdit  = new PettyCash();
         lblID.Text           = ((Label)imgdelete.Parent.FindControl("lblVoucherNo")).Text;
         VoucherNo            = Convert.ToInt32(lblID.Text);
         chkeEdit.VoucherNo   = VoucherNo;
         chkeEdit.Updated_By  = Session["UserName"].ToString();
         chkeEdit.Updated_On  = Convert.ToDateTime(DateTime.Now.ToString());
         chkeEdit.TotalAmount = 0;
         chkeEdit.Is_Active   = false;
         int a = 0;
         chkeEdit.Save(out a);
         MessageBox("Record deleted successfully");
         //GridView grd = (GridView)imgdelete.Parent;
         GridViewRow gvr = (GridViewRow)imgdelete.NamingContainer;
         //Get rowindex
         int rowindex = gvr.RowIndex;
         gvr.Visible = false;
     }
     catch (Exception ex)
     {
         MessageBox("Record not delete due to : " + ex.Message.ToString());
     }
 }
Exemplo n.º 2
0
 protected void lblget_Click(object sender, EventArgs e)
 {
     try
     {
         FromDate = txtFromDate.Text.Split('/')[1] + "/" + txtFromDate.Text.Split('/')[0] + "/" + txtFromDate.Text.Split('/')[2];
         ToDate   = txtToDate.Text.Split('/')[1] + "/" + txtToDate.Text.Split('/')[0] + "/" + txtToDate.Text.Split('/')[2];
         DataTable dt = new DataTable();
         dt = PettyCash.Idv_Chetana_Get_Petty_Expance_View(FromDate, ToDate, Convert.ToInt32(strFY)).Tables[0];
         if (dt.Rows.Count != 0)
         {
             gvExp.DataSource = dt;
             Visibility();
             gvExp.DataBind();
             gvExp.Visible = true;
         }
         else
         {
             gvExp.Visible = false;
             message("No Record Found");
         }
     }
     catch (Exception ex)
     {
         message(ex.Message.ToString());
     }
 }
Exemplo n.º 3
0
        public ActionResult Create(PettyCash pettyCashDetails, HttpPostedFileBase[] memberphoto, DocumentData documentData)
        {
            try
            {
                if (pettyCashDetails.IsValid)
                {
                    if (pettyCashDetails.AttachedFiles is null)
                    {
                        if (documentData.memberphoto != null)
                        {
                            MemoryStream memStream = Util.ToMemoryStream(documentData.memberphoto.InputStream, documentData.memberphoto.ContentLength);
                            Media        media     = Util.SaveReceipt(memStream, documentData.memberphoto.FileName, MediaType.RECEIPTPHOTO);


                            if (media != null)
                            {
                                pettyCashDetails.AttachedFiles = media.FileName;
                            }
                        }
                        pettyCashRepository.Add(pettyCashDetails);
                        return(RedirectToActionPermanent("List"));
                    }
                }
            }
            catch (Exception ex)
            {
                ViewBag.Error = "Invalid Entry";
            }
            return(View(pettyCashDetails));
        }
Exemplo n.º 4
0
    public void Bind()
    {
        string  FromDate = txtFromDate.Text.Split('/')[1] + "/" + txtFromDate.Text.Split('/')[0] + "/" + txtFromDate.Text.Split('/')[2];
        string  ToDate   = txtToDate.Text.Split('/')[1] + "/" + txtToDate.Text.Split('/')[0] + "/" + txtToDate.Text.Split('/')[2];
        DataSet ds       = new DataSet();

        ds = PettyCash.Idv_Chetana_Get_Petty_Expance_CheckList(FromDate, ToDate, Convert.ToInt32(strFY));
        if (ds.Tables[0].Rows.Count > 0)
        {
            //ds2 = PettyCash.Idv_Chetana_Get_Petty_Expance_View(Convert.ToInt32(Request.QueryString["d"].ToString().Trim()),
            //   Convert.ToInt32(Request.QueryString["sd"].ToString().Trim()));

            DataView dv = new DataView(ds.Tables[0]);
            //DataView dv1 = new DataView(ds2.Tables[0]);

            ReportDocument rd = new ReportDocument();
            rd.Load(Server.MapPath("Report/PettyCashDetailsCheckList.rpt"));
            rd.Database.Tables[0].SetDataSource(dv);
            //rd.Database.Tables[1].SetDataSource(dv1);

            PettyCashCheckListCR.ReportSource = rd;
        }
        else
        {
            MessageBox("No Record Found");
            txtFromDate.Focus();
        }
    }
Exemplo n.º 5
0
        public ActionResult Manage([Bind(Include = "CashInHandRegID,Tdate,NameAndDesg,CashToDeclareStart,CashToDeclareEnd,DetailsOfCashExp,Remarks")] PettyCash item)
        {
            string UN = db.ExecuteScalar <string>("Select RealName From AspNetUsers where Id=@0", User.Identity.GetUserId());

            item.NameAndDesg = UN;
            item.Tdate       = DateTime.Now;
            return(base.BaseSave <PettyCash>(item, item.CashInHandRegID > 0));
        }
Exemplo n.º 6
0
 public ActionResult Edit(int?Id)
 {
     if (Id.HasValue)
     {
         PettyCash pettyCash = pettyCashRepository.Get(Id.Value);
         return(View(pettyCash));
     }
     return(RedirectToActionPermanent("list"));
 }
 public void AddPettyCash(PettyCash pettyCash, int userId, string userName, int concernId)
 {
     pettyCash.CreationDate     = DateTime.Now;
     pettyCash.ModificationDate = DateTime.Now;
     pettyCash.ConcernId        = concernId;
     pettyCash.CreatorId        = userId;
     pettyCash.ModifierId       = userId;
     _context.PettyCash.Add(pettyCash);
     _context.SaveChanges();
 }
        public void UpdatePettyCash(PettyCash pettyCash, int userId, string userName, int concernId, int id)
        {
            var petty = _context.PettyCash.FirstOrDefault(x => x.PettyCasId == id);

            petty.Amount           = pettyCash.Amount;
            petty.BankId           = pettyCash.BankId;
            petty.CashDate         = pettyCash.CashDate;
            petty.Description      = pettyCash.Description;
            petty.ModifierId       = userId;
            petty.ModificationDate = DateTime.Now;
            _context.SaveChanges();
        }
Exemplo n.º 9
0
        private void sequenceNumber(PettyCash transactionApi)
        {
            SequenceNumberLog log = new SequenceNumberLog();

            log.StoreCode          = transactionApi.storeCode;
            log.LastNumberSequence = transactionApi.sequenceNumber;
            log.LastTransId        = transactionApi.pettyCashId;
            log.Date            = DateTime.Now;
            log.TransactionType = "Petty Cash";
            _context.SequenceNumberLog.Add(log);
            _context.SaveChanges();
        }
Exemplo n.º 10
0
 public ActionResult Edit(PettyCash pettyCash)
 {
     try
     {
         if (pettyCash.IsValid)
         {
             pettyCashRepository.Update(pettyCash);
             return(RedirectToActionPermanent("List"));
         }
         return(RedirectToActionPermanent("List"));
     }
     catch (Exception ex)
     {
         ViewBag.Error = ex.Message;
     }
     return(View(pettyCash));
 }
Exemplo n.º 11
0
        public ActionResult PettyCashList(DataTablesViewModel param, string fromDate, string toDate)
        {
            try
            {
                if (!PermissionControl.CheckPermission(UserAppPermissions.PettyCash_View))
                {
                    return(RedirectToAction("Restricted", "Home"));
                }

                DateTime frdate = DateTime.Now;
                if (!string.IsNullOrWhiteSpace(fromDate))
                {
                    frdate = DateTime.Parse(fromDate);
                }

                DateTime tdate = DateTime.Now;
                if (!string.IsNullOrWhiteSpace(toDate))
                {
                    tdate = DateTime.Parse(toDate);
                }


                logger.DebugFormat("Getting Petty Cash List with From Date [{0}] and To Date [{1}]", frdate.ToShortDateString(), tdate.ToShortDateString());

                PettyCash pettyCash = new PettyCash();
                pettyCash.DTObject = param;
                var list = pettyCashManagement.GetAllPettyCashByParam(pettyCash, frdate, tdate);
                logger.DebugFormat("Successfully Retrieve  Petty Cash List Records [{2}] with From Date [{0}] and To Date [1]", frdate.ToShortDateString(), tdate.ToShortDateString(), list.Count());

                return(Json(new
                {
                    sEcho = param.draw,
                    iTotalRecords = list.Select(i => i.DTObject.TotalRecordsCount).FirstOrDefault(),
                    iTotalDisplayRecords = list.Select(i => i.DTObject.TotalRecordsCount).FirstOrDefault(), // Filtered Count
                    aaData = list
                }));
            }
            catch (Exception ex)
            {
                logger.ErrorFormat("Exception Raised : Message[{0}] Stack Trace [{1}] ", ex.Message, ex.StackTrace);
                return(null);
            }
        }
Exemplo n.º 12
0
    protected void gvExp_RowEditing(object sender, GridViewEditEventArgs e)
    {
        PettyCash chkeEdit = new PettyCash();

        lblID.Text           = ((Label)gvExp.Rows[e.NewEditIndex].FindControl("lblVoucherNo")).Text;
        VoucherNo            = Convert.ToInt32(lblID.Text);
        txtEMcode.Text       = ((Label)gvExp.Rows[e.NewEditIndex].FindControl("lblpartycode")).Text;
        lblshow.Text         = ((Label)gvExp.Rows[e.NewEditIndex].FindControl("lblPartyName")).Text;
        txtRemark.Text       = ((Label)gvExp.Rows[e.NewEditIndex].FindControl("lblRemarkedit")).Text;
        txtVocDate.Text      = ((Label)gvExp.Rows[e.NewEditIndex].FindControl("lbldate")).Text;
        chkeEdit.TotalAmount = amount + amount2;
        chkeEdit.Updated_By  = Session["UserName"].ToString();
        chkeEdit.Updated_On  = Convert.ToDateTime(DateTime.Now.ToString());
        pnlCust.Visible      = true;
        btn_Save.Visible     = true;
        gvExp.Visible        = false;
        pnlViewexp.Visible   = false;
        gvVoucher.Visible    = false;
        bindforedit();
    }
Exemplo n.º 13
0
        public JsonResult Delete(long id)
        {
            try
            {
                logger.DebugFormat("Deleting Petty Cash With PettyCashID [{0}] ", id);

                if (!PermissionControl.CheckPermission(UserAppPermissions.PettyCash_Delete))
                {
                    logger.Info("Don't have right to delete Petty Cash record");
                    return(Json(new { Message = Resources.Messages.MSG_RESTRICTED_ACCESS, MessageClass = MessageClass.Error, Response = false }));
                }

                PettyCash pettyCash = pettyCashManagement.GetPettyCash(id);


                if (pettyCash.TransactionDate.Date < DateTime.Now.AddDays(-1).Date)
                {
                    return(Json(new { Message = Resources.Messages.MSG_GENERIC_DELETE_RECORD, MessageClass = MessageClass.Error, Response = false }));
                }


                pettyCash.IsDeleted = true;
                if (pettyCashManagement.Delete(pettyCash))
                {
                    pettyCashManagement.SavePettyCash();
                    logger.Info("Petty Cash record Successfully Deleted");
                    return(Json(new { Message = Resources.Messages.MSG_GENERIC_DELETE_SUCCESS, MessageClass = MessageClass.Success, Response = true }));
                }
                else
                {
                    logger.Info("Petty Cash record not deleted");
                    return(Json(new { Message = Resources.Messages.MSG_GENERIC_DELETE_FAILED, MessageClass = MessageClass.Error, Response = false }));
                }
            }
            catch (Exception ex)
            {
                logger.ErrorFormat("Exception Raised : Message[{0}] Stack Trace [{1}] ", ex.Message, ex.StackTrace);
                return(Json(new { Message = Resources.Messages.MSG_GENERIC_DELETE_FAILED, MessageClass = MessageClass.Error, Response = false }));
            }
        }
Exemplo n.º 14
0
        public JsonResult AddEdit(PettyCash model)
        {
            try
            {
                logger.DebugFormat("Add Petty Cash with TransactionDate [{0}],  TransactionType [{1}],  ChartOfAccountTitle [{2}], Amount [{3}],  Description [{4}]  ",
                                   model.TransactionDate, model.TransactionType, model.ChartOfAccountTitle, model.Amount, model.Description);
                if (!PermissionControl.CheckPermission(UserAppPermissions.PettyCash_Add))
                {
                    logger.Info("Don't have rights to add  Petty Cash");
                    return(Json(new { Message = Resources.Messages.MSG_RESTRICTED_ACCESS, MessageClass = MessageClass.Error, Response = false }));
                }

                if (ModelState.IsValid)
                {
                    model.UserID = new Guid(User.Identity.GetUserId());
                    if (pettyCashManagement.Add(model))
                    {
                        pettyCashManagement.SavePettyCash();
                        logger.Info("Successfully Saved Petty Cash ");
                        return(Json(new { Message = string.Format(Resources.Messages.MSG_GENERIC_ADD_SUCCESS, "PettyCash"), MessageClass = MessageClass.Success, Response = true }));
                    }
                    else
                    {
                        logger.Info("Petty Cash Not Saved");
                        return(Json(new { Message = string.Format("Validation Failded", "PettyCash"), MessageClass = MessageClass.Error, Response = false }));
                    }
                }
                else
                {
                    return(Json(new { Message = string.Format(Resources.Messages.MSG_GENERIC_ADD_FAILED, "PettyCash"), MessageClass = MessageClass.Error, Response = false }));
                }
            }
            catch (Exception ex)
            {
                logger.ErrorFormat("Exception Raised : Message[{0}] Stack Trace [{1}] ", ex.Message, ex.StackTrace);
                return(Json(new { Message = Resources.Messages.MSG_GENERIC_FAILED, MessageClass = MessageClass.Error, Response = false }));
            }
        }
Exemplo n.º 15
0
    public void BindPrintDC()
    {
        if (Request.QueryString["d"] != null && Request.QueryString["sd"] != null)
        {
            DataSet ds = new DataSet();
            // DataSet ds2 = new DataSet();

            ds = PettyCash.Idv_Chetana_Get_Petty_Expance_View(Convert.ToString(Request.QueryString["d"].ToString().Trim()),
                                                              Convert.ToString(Request.QueryString["sd"].ToString().Trim()));
            //ds2 = PettyCash.Idv_Chetana_Get_Petty_Expance_View(Convert.ToInt32(Request.QueryString["d"].ToString().Trim()),
            //   Convert.ToInt32(Request.QueryString["sd"].ToString().Trim()));

            DataView dv = new DataView(ds.Tables[0]);
            //DataView dv1 = new DataView(ds2.Tables[0]);

            ReportDocument rd = new ReportDocument();
            rd.Load(Server.MapPath("../Report/PettyCashDetails.rpt"));
            rd.Database.Tables[0].SetDataSource(dv);
            //rd.Database.Tables[1].SetDataSource(dv1);

            PrintPettyCash.ReportSource = rd;
        }
    }
Exemplo n.º 16
0
        public static void MenuEvent(ref SAPbouiCOM.MenuEvent pVal, out bool BubbleEvent)
        {
            BubbleEvent = true;
            if (objExpenses == null)
            {
                objExpenses = new Operations();
            }
            try
            {
                #region Clasificación Tipos
                if (pVal.MenuUID == "BYB_MEX008" &&
                    !pVal.BeforeAction)
                {
                    MainObject.Instance.B1Application.OpenForm(SAPbouiCOM.BoFormObjectEnum.fo_UserDefinedObject, Settings._Main.ExpenseTypeClasificatioonUDOFormType, "");
                }
                #endregion

                #region Conceptos
                if (pVal.MenuUID == "BYB_MEX005" &&
                    !pVal.BeforeAction)
                {
                    Expenses.openConceptsForm(pVal);
                }

                #endregion

                #region Tipos
                if (pVal.MenuUID == "BYB_MEX006" &&
                    !pVal.BeforeAction)
                {
                    Expenses.openExpenseTypeForm(pVal);
                }
                #endregion

                #region Solicitud
                if (pVal.MenuUID == "BYB_MEX007" &&
                    !pVal.BeforeAction)
                {
                    Expenses.openExpenseRequestForm(pVal);
                }

                if (pVal.MenuUID == "1282" &&
                    !pVal.BeforeAction)
                {
                    SAPbouiCOM.Form objForm = MainObject.Instance.B1Application.Forms.ActiveForm;
                    if (objForm.TypeEx == Settings._Main.ExpenseRequestUDoFormType)
                    {
                        Expenses.configureExpenseRequestFOrm(objForm.UniqueID, false);
                    }
                }
                #endregion

                #region Aprobación
                if (pVal.MenuUID == "BYB_MEX009" &&
                    !pVal.BeforeAction)
                {
                    Expenses.loadPendingAppovedRequestForm();
                }
                #endregion

                #region Desembolsos
                if (pVal.MenuUID == "BYB_MEX010" &&
                    !pVal.BeforeAction)
                {
                    Expenses.loadPaymentForm();
                }
                #endregion

                #region Legalización
                if (pVal.MenuUID == "BYB_MEX011" &&
                    !pVal.BeforeAction)
                {
                    Expenses.openLegalizationForm(pVal);
                }

                if (pVal.MenuUID == "1282" &&
                    !pVal.BeforeAction)
                {
                    SAPbouiCOM.Form objForm = MainObject.Instance.B1Application.Forms.ActiveForm;
                    if (objForm.TypeEx == Settings._Main.ExpenseRequestUDoFormType)
                    {
                        Expenses.configureLegalizationForm(objForm.UniqueID, false);
                    }
                }

                if (pVal.MenuUID == "BYB_T1EXP400_Remove_Line" &&
                    !pVal.BeforeAction)
                {
                    string strLastUID = CacheManager.CacheManager.Instance.getFromCache(Settings._Main.LastExpenseActiveForm) == null ? "" : CacheManager.CacheManager.Instance.getFromCache(Settings._Main.LastExpenseActiveForm);
                    Expenses.deleteRowAfter(strLastUID);
                }
                #endregion

                #region Cajas Menores
                if (pVal.MenuUID == "BYB_MCM002" &&
                    !pVal.BeforeAction)
                {
                    PettyCash.loadPettyCashPaymentForm();
                }

                if (pVal.MenuUID == "BYB_MCM007" &&
                    !pVal.BeforeAction)
                {
                    MainObject.Instance.B1Application.OpenForm(SAPbouiCOM.BoFormObjectEnum.fo_UserDefinedObject, "BYB_T1PTC100", "");
                }

                if (pVal.MenuUID == "BYB_MCM006" &&
                    !pVal.BeforeAction)
                {
                    MainObject.Instance.B1Application.OpenForm(SAPbouiCOM.BoFormObjectEnum.fo_UserDefinedObject, "BYB_T1PTC200", "");
                }

                if (pVal.MenuUID == "BYB_MCM004" &&
                    !pVal.BeforeAction)
                {
                    PettyCash.openLegalizationForm(pVal);
                    //MainObject.Instance.B1Application.OpenForm(SAPbouiCOM.BoFormObjectEnum.fo_UserDefinedObject, "BYB_T1PTC300", "");
                }

                if (pVal.MenuUID == "1282" &&
                    !pVal.BeforeAction)
                {
                    SAPbouiCOM.Form objForm = MainObject.Instance.B1Application.Forms.ActiveForm;
                    if (objForm.TypeEx == Settings._MainPettyCash.pettyCashPaymentFormType)
                    {
                        PettyCash.configureLegalizationForm(objForm.UniqueID, false);
                    }
                }

                #endregion
            }
            catch (Exception er)
            {
                _Logger.Error("", er);
            }
        }
Exemplo n.º 17
0
        public ActionResult Create()
        {
            PettyCash pettyCash = new PettyCash();

            return(View(pettyCash));
        }
Exemplo n.º 18
0
 public mUCs(PettyCash form)
 {
     m_form    = form;
     m_panel   = form.Controls["pan_UC"];
     m_balance = form.Controls["pan_Balance"];
 }
Exemplo n.º 19
0
        public async Task <IActionResult> PostTransaction([FromBody] PettyCash transactionApi)
        {
            int orno = 0;
            //insert storeCode
            bool isStoreExist = _context.ExpenseStore.Any(c => c.StoreCode == transactionApi.storeCode);

            if (!isStoreExist)
            {
                ExpenseStore expenseStore = new ExpenseStore();
                expenseStore.StoreCode     = transactionApi.storeCode;
                expenseStore.RemaingBudget = 0;
                expenseStore.TotalExpense  = 0;
                expenseStore.Year          = DateTime.Now.Year;
                _context.ExpenseStore.Add(expenseStore);
            }
            APIResponse response = new APIResponse();

            try
            {
                //perbaiki transaksi petty cash
                //add more unit;
                orno = _context.Expense.Count() + transactionApi.pettyCashLine.Count();
                InforAPIPettyCash inforAPIPettyCash = new InforAPIPettyCash(_context);
                String            itrn = inforAPIPettyCash.getRoundNumber();
                foreach (PettyCashLine pl in transactionApi.pettyCashLine)
                {
                    Expense expense = new Expense();
                    expense.Amount           = (pl.price * pl.quantity);
                    expense.CostCategoryId   = transactionApi.expenseCategoryId;
                    expense.CostCategoryName = transactionApi.expenseCategory;
                    expense.ExpenseName      = pl.expenseName;
                    expense.StoreCode        = transactionApi.storeCode;
                    expense.Price            = pl.price;
                    expense.Qty      = pl.quantity;
                    expense.TypeId   = Config.RetailEnum.expenseExpense;
                    expense.TypeName = "Expense";
                    expense.Orno     = "PC" + orno;
                    expense.Itrn     = itrn;
                    try
                    {
                        expense.TransactionDate = DateTime.ParseExact(transactionApi.timeStamp, "MMM dd, yyyy h:mm:ss tt", CultureInfo.InvariantCulture);
                    }
                    catch
                    {
                        expense.TransactionDate = DateTime.ParseExact(transactionApi.date + transactionApi.time, "yyyy-MM-dd" + "H:mm:ss", CultureInfo.InvariantCulture);
                    }
                    _context.Add(expense);
                    _context.SaveChanges();
                }
                //log record

                this.updateExpense(transactionApi.storeCode);
                //post to infor
                inforAPIPettyCash.postPettyCash(transactionApi, orno, itrn).Wait();

                response.code    = "1";
                response.message = "Sucess Add Data";

                this.sequenceNumber(transactionApi);
            }
            catch (Exception ex)
            {
                response.code    = "0";
                response.message = ex.ToString();
            }
            LogRecord log = new LogRecord();

            log.TimeStamp = DateTime.Now;
            log.Tag       = "Petty Cash";
            log.Message   = JsonConvert.SerializeObject(transactionApi);
            _context.LogRecord.Add(log);
            _context.SaveChanges();

            return(Ok(response));
        }
        private IQueryable <PettyCash> GetPettyCashFiltersOrderQuery(IQueryable <PettyCash> query, PettyCash param, bool forAll = false)
        {
            try
            {
                //   var expression = PredicateBuilder.True<AssetsEntity>();
                if (param == null)
                {
                    return(query);
                }

                int index = -1;
                foreach (var columnData in param.DTObject.columns)
                {
                    index += 1;
                    if (columnData.orderable)
                    {
                        foreach (var row in param.DTObject.order.Where(i => i.column == index))
                        {
                            if (row.dir == "asc")
                            {
                                query = query.OrderBy(columnData.data);
                            }
                            else
                            {
                                query = query.OrderByDescending(columnData.data);
                            }
                        }
                    }


                    if (columnData.search.value == null || string.IsNullOrEmpty(columnData.search.value.Trim()))
                    {
                        continue;
                    }
                    switch (columnData.data)
                    {
                    case "Description":
                        if (!forAll)
                        {
                            query = query.Where(col => col.Description.ToUpper().Contains(columnData.search.value.ToUpper()));
                        }
                        break;
                    }
                }

                if (param.DTObject.search.value != null && !string.IsNullOrEmpty(param.DTObject.search.value))
                {
                    query = query.Where(col => (
                                            col.Description.ToUpper().Contains(param.DTObject.search.value.ToUpper()) ||
                                            col.TransactionType.ToUpper().Contains(param.DTObject.search.value.ToUpper()) ||
                                            col.Amount.ToString().Contains(param.DTObject.search.value.ToUpper())));
                }
                return(query);


                return(query);
            }
            catch (Exception ex)
            {
                logger.ErrorFormat("Exception Raised : Message[{0}] Stack Trace [{1}] ", ex.Message, ex.StackTrace);
                return(null);
            }
        }
Exemplo n.º 21
0
    protected void btn_Save_Click(object sender, EventArgs e)
    {
        try
        {
            if (Session["UserName"] != null)
            {
                if (gvExpense.Rows.Count > 0 || gvExpDelete.Rows.Count > 0)
                {
                    PettyCash pt = new PettyCash();
                    pt.VoucherNo  = Convert.ToInt32(lblID.Text);
                    pt.PartyCode  = txtEMcode.Text.Trim();
                    pt.PartyName  = lblshow.Text.Trim();
                    pt.MainRemark = txtRemark.Text.Trim();
                    string vocdate = txtVocDate.Text.Split('/')[1] + "/" + txtVocDate.Text.Split('/')[0] + "/" + txtVocDate.Text.Split('/')[2];
                    pt.VoucherDate = Convert.ToDateTime(vocdate);
                    pt.Created_By  = Session["UserName"].ToString();
                    pt.Is_Active   = Convert.ToBoolean(true);
                    //if (gvExpense.Rows.Count > 0)
                    //{
                    //  pt.TotalAmount = Convert.ToDecimal(amount + amount);

                    if (gvExpDelete.Rows.Count > 0)
                    {
                        pt.TotalAmount = Convert.ToDecimal(amount2);
                        if (gvExpense.Rows.Count > 0 && gvExpDelete.Rows.Count > 0)
                        {
                            pt.TotalAmount = Convert.ToDecimal(amount + amount2);
                        }
                    }
                    else if (gvExpense.Rows.Count > 0)
                    {
                        pt.TotalAmount = Convert.ToDecimal(amount);
                        if (gvExpense.Rows.Count > 0 && gvExpDelete.Rows.Count > 0)
                        {
                            pt.TotalAmount = Convert.ToDecimal(amount + amount2);
                        }
                    }

                    pt.FY = Convert.ToInt32(strFY);

                    pt.Save(out IDNo, out NewDocNo);
                    lblId3.Text = Convert.ToString("Voucher No :" + (NewDocNo));
                    SaveDetails(IDNo);
                    // lblID1.Text = Convert.ToString("Voucher No :" + (IDNo));
                    //  SaveDetails(IDNo);
                    message("Record save successfully");
                    lblId3.Visible      = true;
                    Session["tempdata"] = null;
                    gvExpense.DataBind();
                    txtEMcode.Text  = "";
                    txtRemark.Text  = "";
                    lblshow.Text    = "";
                    txtVocDate.Text = "";

                    gvExpDelete.Visible = false;
                    if (lblID.Text == "0")
                    {
                        lblId3.Visible = true;
                    }
                    else
                    {
                        lblId3.Text        = "";
                        pnlCust.Visible    = false;
                        pnlViewexp.Visible = true;
                        btn_Save.Visible   = false;
                    }
                }
                message("Enter Expence Details");
            }
        }
        catch
        { }
    }
Exemplo n.º 22
0
 public bool Add(PettyCash model)
 {
     return(pettyCashRepository.Add(model));
 }
Exemplo n.º 23
0
 public IEnumerable <PettyCash> GetAllPettyCashByParam(PettyCash param, DateTime fromDate, DateTime toDate)
 {
     return(pettyCashRepository.GetAllPettyCashByParam(param, fromDate, toDate));
 }
Exemplo n.º 24
0
 public bool Delete(PettyCash pettyCash)
 {
     return(pettyCashRepository.Update(pettyCash));
 }
Exemplo n.º 25
0
        public static void formDataAddEvent(ref SAPbouiCOM.BusinessObjectInfo BusinessObjectInfo, out bool blBubbleEvent)
        {
            if (objExpenses == null)
            {
                objExpenses = new Operations();
            }

            blBubbleEvent = true;

            try
            {
                #region Legalizaciones
                #region Solicitud
                if (
                    BusinessObjectInfo.ActionSuccess &&
                    BusinessObjectInfo.FormTypeEx == Settings._Main.ExpenseRequestUDoFormType &&
                    !BusinessObjectInfo.BeforeAction &&
                    BusinessObjectInfo.EventType == SAPbouiCOM.BoEventTypes.et_FORM_DATA_ADD
                    )
                {
                }

                if (
                    BusinessObjectInfo.ActionSuccess &&
                    BusinessObjectInfo.FormTypeEx == Settings._Main.ExpenseRequestUDoFormType &&
                    !BusinessObjectInfo.BeforeAction &&
                    BusinessObjectInfo.ActionSuccess &&
                    BusinessObjectInfo.EventType == SAPbouiCOM.BoEventTypes.et_FORM_DATA_UPDATE
                    )
                {
                }
                if (
                    BusinessObjectInfo.ActionSuccess &&
                    BusinessObjectInfo.FormTypeEx == Settings._Main.ExpenseRequestUDoFormType &&
                    !BusinessObjectInfo.BeforeAction &&
                    BusinessObjectInfo.ActionSuccess &&
                    BusinessObjectInfo.EventType == SAPbouiCOM.BoEventTypes.et_FORM_DATA_LOAD
                    )
                {
                }
                #endregion

                #region Legalizacion
                if (
                    BusinessObjectInfo.ActionSuccess &&
                    BusinessObjectInfo.FormTypeEx == Settings._Main.LegalizationRequestUDoFormType &&
                    !BusinessObjectInfo.BeforeAction &&
                    BusinessObjectInfo.ActionSuccess &&
                    BusinessObjectInfo.EventType == SAPbouiCOM.BoEventTypes.et_FORM_DATA_LOAD
                    )
                {
                    Expenses.getLegalizationDocEntryOnLoad(BusinessObjectInfo);
                }

                if (
                    BusinessObjectInfo.ActionSuccess &&
                    BusinessObjectInfo.FormTypeEx == Settings._Main.LegalizationRequestUDoFormType &&
                    !BusinessObjectInfo.BeforeAction &&
                    BusinessObjectInfo.ActionSuccess &&
                    BusinessObjectInfo.EventType == SAPbouiCOM.BoEventTypes.et_FORM_DATA_ADD
                    )
                {
                    Expenses.changeRequestStatus(BusinessObjectInfo);
                }


                #endregion
                #endregion

                #region Caja Menor Legalizacion
                if (
                    BusinessObjectInfo.ActionSuccess &&
                    BusinessObjectInfo.FormTypeEx == Settings._MainPettyCash.pettyCashLegalizationFormType &&
                    !BusinessObjectInfo.BeforeAction &&
                    BusinessObjectInfo.ActionSuccess &&
                    BusinessObjectInfo.EventType == SAPbouiCOM.BoEventTypes.et_FORM_DATA_LOAD
                    )
                {
                    PettyCash.getPCLegalizationDocEntryOnLoad(BusinessObjectInfo);
                }
                #endregion
            }
            catch (COMException comEx)
            {
                Exception er = new Exception(Convert.ToString("COM Error::" + comEx.ErrorCode + "::" + comEx.Message + "::" + comEx.StackTrace));
                _Logger.Error("FormDataEvent Error", comEx);
            }
            catch (Exception er)
            {
                _Logger.Error("FormDataEvent Error", er);
            }
        }
Exemplo n.º 26
0
        public async Task <String> postPettyCash([FromBody] PettyCash transaction, int id, String roundNumberParam)
        {
            var credentials = new NetworkCredential(inforConfig.username, inforConfig.password);
            var handler     = new HttpClientHandler {
                Credentials = credentials
            };

            handler.ServerCertificateCustomValidationCallback = (message, cert, chain, errors) => { return(true); };
            String status      = "";
            String roundNumber = roundNumberParam;

            using (var client = new HttpClient(handler))
            {
                // Make your request...
                client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
                try
                {
                    InforPettyCash inforObjTrans = new InforPettyCash();
                    inforObjTrans.program = "OPS270MI";
                    List <TransactionPettyCash> listTransaction = new List <TransactionPettyCash>();
                    for (int i = 0; i < transaction.pettyCashLine.Count; i++)
                    {
                        TransactionPettyCash t = new TransactionPettyCash();
                        t.transaction = "AddSlsTicketLin";
                        RecordPettyCash record = new RecordPettyCash();
                        record.CONO = "770";
                        record.DIVI = "AAA";
                        record.XRCD = "7000";
                        record.ITRN = roundNumber;
                        record.WHLO = transaction.storeCode;
                        record.ORNO = "PC" + id + "";
                        record.DLIX = "1";
                        record.PONR = (i + 1) + "";
                        record.POSX = "00";
                        record.CUCD = "IDR";
                        record.CUNO = transaction.customerIdStore;
                        record.ITNO = transaction.expenseCategoryId;
                        record.TRDT = DateTime.Now.ToString("yyyyMMdd");
                        record.TRTM = DateTime.Now.ToString("HHmmss");//"113000";
                        record.CUAM = transaction.pettyCashLine[i].total + "";
                        record.CSHC = "CSH";
                        record.VTCD = "0";
                        record.PYCD = "CSH";
                        record.ALUN = "PCS";

                        record.IVQA = transaction.pettyCashLine[i].quantity + "";
                        record.REFE = transaction.pettyCashLine[i].expenseName;
                        record.INYR = DateTime.Now.Year + "";
                        record.VTP1 = 0 + "";
                        record.ARAT = 1 + "";
                        record.CRTP = 1 + "";

                        t.record = record;
                        listTransaction.Add(t);
                    }

                    //sales ticket line



                    inforObjTrans.transactions = listTransaction;
                    HttpResponseMessage message = await client.PostAsJsonAsync(General.urlInfor, inforObjTrans);

                    if (message.IsSuccessStatusCode)
                    {
                        status = message.ToString();
                        var                serializer = new DataContractJsonSerializer(typeof(InforObjPostReturn));
                        var                result     = message.Content.ReadAsStringAsync().Result;
                        byte[]             byteArray  = Encoding.UTF8.GetBytes(result);
                        MemoryStream       stream     = new MemoryStream(byteArray);
                        InforObjPostReturn resultData = serializer.ReadObject(stream) as InforObjPostReturn;
                        //  status = "Return : " + resultData.results[0].errorMessage + "Sukses "+ resultData.nrOfSuccessfullTransactions;
                        IntegrationLog log = new IntegrationLog();
                        log.Description                 = transaction.pettyCashId;
                        log.ErrorMessage                = resultData.results[0].errorMessage;
                        log.NrOfFailedTransactions      = resultData.nrOfFailedTransactions;
                        log.NrOfSuccessfullTransactions = resultData.nrOfSuccessfullTransactions;
                        log.NumOfLineSubmited           = listTransaction.Count;
                        log.RefNumber       = transaction.pettyCashId + "";
                        log.Json            = JsonConvert.SerializeObject(inforObjTrans);
                        log.TransactionType = "OPS270MI-PettyCashTcktLine";
                        _context.IntegrationLog.Add(log);
                        _context.SaveChanges();
                    }
                    else
                    {
                        status = "Failed : " + message.ToString();
                    }
                    //send ticket pay

                    List <TransactionPettyCash> listTransactionPay = new List <TransactionPettyCash>();
                    InforPettyCash inforObjPay = new InforPettyCash();
                    inforObjPay.program = "OPS270MI";
                    TransactionPettyCash tRansactionAddSlsTicketPay = new TransactionPettyCash();
                    tRansactionAddSlsTicketPay.transaction = "AddSlsTicketPay";
                    RecordPettyCash recordAddSlsTicketPayEDC2 = new RecordPettyCash();
                    recordAddSlsTicketPayEDC2.CONO = "770";
                    recordAddSlsTicketPayEDC2.DLIX = "1";
                    recordAddSlsTicketPayEDC2.DIVI = "AAA";
                    recordAddSlsTicketPayEDC2.XRCD = "7090";
                    recordAddSlsTicketPayEDC2.ITRN = roundNumber;
                    recordAddSlsTicketPayEDC2.WHLO = transaction.storeCode;
                    recordAddSlsTicketPayEDC2.ORNO = "PC" + id + "";
                    recordAddSlsTicketPayEDC2.PONR = (transaction.pettyCashLine.Count + 1) + "";
                    recordAddSlsTicketPayEDC2.POSX = "00";
                    recordAddSlsTicketPayEDC2.CUCD = "IDR";
                    recordAddSlsTicketPayEDC2.TRDT = DateTime.Now.ToString("yyyyMMdd");
                    recordAddSlsTicketPayEDC2.TRTM = DateTime.Now.ToString("HHmmss");//"113000";
                    recordAddSlsTicketPayEDC2.CUAM = transaction.totalExpense + "";
                    recordAddSlsTicketPayEDC2.PYCD = "CSH";
                    recordAddSlsTicketPayEDC2.REFE = transaction.expenseCategory;
                    recordAddSlsTicketPayEDC2.ARAT = "1";
                    recordAddSlsTicketPayEDC2.CRTP = "1";
                    recordAddSlsTicketPayEDC2.ALUN = "PCS";
                    recordAddSlsTicketPayEDC2.CSHC = "CSH";

                    tRansactionAddSlsTicketPay.record = recordAddSlsTicketPayEDC2;
                    listTransactionPay.Add(tRansactionAddSlsTicketPay);
                    inforObjPay.transactions = listTransactionPay;
                    HttpResponseMessage messagebatch = await client.PostAsJsonAsync(Config.General.urlInfor, inforObjPay);

                    if (messagebatch.IsSuccessStatusCode)
                    {
                        status = messagebatch.ToString();
                        var                serializer = new DataContractJsonSerializer(typeof(InforObjPostReturn));
                        var                result     = messagebatch.Content.ReadAsStringAsync().Result;
                        byte[]             byteArray  = Encoding.UTF8.GetBytes(result);
                        MemoryStream       stream     = new MemoryStream(byteArray);
                        InforObjPostReturn resultData = serializer.ReadObject(stream) as InforObjPostReturn;
                        //  status = "Return : " + resultData.results[0].errorMessage + "Sukses "+ resultData.nrOfSuccessfullTransactions;
                        IntegrationLog log = new IntegrationLog();
                        log.Description                 = transaction.pettyCashId;
                        log.ErrorMessage                = resultData.results[0].errorMessage;
                        log.NrOfFailedTransactions      = resultData.nrOfFailedTransactions;
                        log.NrOfSuccessfullTransactions = resultData.nrOfSuccessfullTransactions;
                        log.NumOfLineSubmited           = listTransaction.Count;
                        log.RefNumber       = transaction.pettyCashId + "";
                        log.Json            = JsonConvert.SerializeObject(inforObjPay);
                        log.TransactionType = "OPS270MI-PettyCashTkcPay";
                        _context.IntegrationLog.Add(log);
                        _context.SaveChanges();
                    }
                    //end for pay

                    //send batch
                    //for auto batch
                    List <TransactionPettyCash> listTransactionbatch = new List <TransactionPettyCash>();
                    InforPettyCash inforObjBatch = new InforPettyCash();
                    inforObjBatch.program = "OPS270MI";
                    TransactionPettyCash tRansactionAddBatch = new TransactionPettyCash();
                    tRansactionAddBatch.transaction = "BchPrcRound";
                    RecordPettyCash recordRoundNumber = new RecordPettyCash();
                    recordRoundNumber.CONO     = "770";
                    recordRoundNumber.ITRN     = roundNumber;
                    recordRoundNumber.DIVI     = "AAA";
                    recordRoundNumber.TRDT     = DateTime.Now.ToString("yyyyMMdd");
                    recordRoundNumber.WHLO     = transaction.storeCode;
                    recordRoundNumber.ACDT     = DateTime.Now.ToString("yyyyMMdd");
                    tRansactionAddBatch.record = recordRoundNumber;
                    listTransactionbatch.Add(tRansactionAddBatch);
                    inforObjBatch.transactions = listTransactionbatch;
                    HttpResponseMessage messageTicketPay = await client.PostAsJsonAsync(Config.General.urlInfor, inforObjBatch);

                    if (messageTicketPay.IsSuccessStatusCode)
                    {
                        status = messageTicketPay.ToString();
                        var                serializer = new DataContractJsonSerializer(typeof(InforObjPostReturn));
                        var                result     = messageTicketPay.Content.ReadAsStringAsync().Result;
                        byte[]             byteArray  = Encoding.UTF8.GetBytes(result);
                        MemoryStream       stream     = new MemoryStream(byteArray);
                        InforObjPostReturn resultData = serializer.ReadObject(stream) as InforObjPostReturn;
                        //  status = "Return : " + resultData.results[0].errorMessage + "Sukses "+ resultData.nrOfSuccessfullTransactions;
                        IntegrationLog log = new IntegrationLog();
                        log.Description                 = transaction.pettyCashId;
                        log.ErrorMessage                = resultData.results[0].errorMessage;
                        log.NrOfFailedTransactions      = resultData.nrOfFailedTransactions;
                        log.NrOfSuccessfullTransactions = resultData.nrOfSuccessfullTransactions;
                        log.NumOfLineSubmited           = listTransaction.Count;
                        log.RefNumber       = transaction.pettyCashId + "";
                        log.Json            = JsonConvert.SerializeObject(inforObjBatch);
                        log.TransactionType = "OPS270MI-PettyCashBatch";
                        _context.IntegrationLog.Add(log);
                        _context.SaveChanges();
                    }
                }
                catch (Exception ex)
                {
                    status = ex.ToString();
                }
            }
            return(status);
        }
Exemplo n.º 27
0
        public static void ItemEvent(string FormUID, ref SAPbouiCOM.ItemEvent pVal, out bool BubbleEvent)
        {
            BubbleEvent = true;
            try
            {
                #region General

                CacheManager.CacheManager.Instance.addToCache(Settings._Main.LastExpenseActiveForm, pVal.FormUID, CacheManager.CacheManager.objCachePriority.NotRemovable);



                #endregion


                #region Conceptos
                #region Concepts ChooseFromList BP

                if (pVal.FormTypeEx == Settings._Main.ConceptUDOFormType &&
                    pVal.EventType == SAPbouiCOM.BoEventTypes.et_CHOOSE_FROM_LIST &&
                    pVal.ItemUID == "0_U_G" &&
                    !pVal.BeforeAction
                    )
                {
                    SAPbouiCOM.Form objForm = MainObject.Instance.B1Application.Forms.Item(pVal.FormUID);
                    Expenses.loadBPNameCFL(objForm, pVal);
                }



                #endregion

                #region Filter Account CFL
                if (pVal.FormTypeEx == Settings._Main.ConceptUDOFormType &&
                    pVal.EventType == SAPbouiCOM.BoEventTypes.et_CHOOSE_FROM_LIST &&
                    pVal.BeforeAction &&
                    pVal.ItemUID == "14_U_E"
                    )
                {
                    Expenses.filterAccountConceptsUDO(pVal, false);
                }

                if (pVal.FormTypeEx == Settings._Main.ConceptUDOFormType &&
                    pVal.EventType == SAPbouiCOM.BoEventTypes.et_CHOOSE_FROM_LIST &&
                    !pVal.BeforeAction &&
                    pVal.ItemUID == "14_U_E"
                    )
                {
                    Expenses.filterAccountConceptsUDO(pVal, true);
                }
                #endregion

                #endregion

                #region Tipos


                #region Filter Account CFL
                if (pVal.FormTypeEx == Settings._Main.ExpenseTypeUDOFormType &&
                    pVal.EventType == SAPbouiCOM.BoEventTypes.et_CHOOSE_FROM_LIST &&
                    pVal.BeforeAction &&
                    pVal.ItemUID == "16_U_E"
                    )
                {
                    Expenses.filterAccountExpTypeUDO(pVal, false);
                }

                if (pVal.FormTypeEx == Settings._Main.ExpenseTypeUDOFormType &&
                    pVal.EventType == SAPbouiCOM.BoEventTypes.et_CHOOSE_FROM_LIST &&
                    !pVal.BeforeAction &&
                    pVal.ItemUID == "16_U_E"
                    )
                {
                    Expenses.filterAccountExpTypeUDO(pVal, true);
                }
                #endregion

                #endregion

                #region Solicitud
                if (pVal.FormTypeEx == Settings._Main.ExpenseRequestUDoFormType &&
                    pVal.EventType == SAPbouiCOM.BoEventTypes.et_FORM_LOAD &&
                    !pVal.BeforeAction

                    )
                {
                    CacheManager.CacheManager.Instance.addToCache(Settings._Main.ExpenseRequestFormLastId, pVal.FormUID, CacheManager.CacheManager.objCachePriority.Default);
                }

                if (pVal.FormTypeEx == Settings._Main.ExpenseRequestUDoFormType &&
                    pVal.EventType == SAPbouiCOM.BoEventTypes.et_CHOOSE_FROM_LIST &&
                    pVal.BeforeAction &&
                    pVal.ItemUID == "1_U_G"

                    )
                {
                    Expenses.filterStepTypeUDO(pVal, false);
                }
                if (pVal.FormTypeEx == Settings._Main.ExpenseRequestUDoFormType &&
                    pVal.EventType == SAPbouiCOM.BoEventTypes.et_CHOOSE_FROM_LIST &&
                    !pVal.BeforeAction &&
                    pVal.ItemUID == "1_U_G"

                    )
                {
                    Expenses.filterStepTypeUDO(pVal, true);
                }

                if (pVal.FormTypeEx == Settings._Main.ExpenseRequestUDoFormType &&
                    pVal.EventType == SAPbouiCOM.BoEventTypes.et_CHOOSE_FROM_LIST &&
                    pVal.BeforeAction &&
                    pVal.ItemUID == "26_U_E"

                    )
                {
                    Expenses.filterStatusUDO(pVal, false);
                }
                if (pVal.FormTypeEx == Settings._Main.ExpenseRequestUDoFormType &&
                    pVal.EventType == SAPbouiCOM.BoEventTypes.et_CHOOSE_FROM_LIST &&
                    !pVal.BeforeAction &&
                    pVal.ItemUID == "26_U_E"

                    )
                {
                    Expenses.filterStatusUDO(pVal, true);
                }

                #endregion

                #region Aprobacion
                //if(pVal.EventType == SAPbouiCOM.BoEventTypes.et_MATRIX_LINK_PRESSED
                //    && pVal.FormTypeEx == "BYB_REQAPR"
                //    && pVal.ItemUID == "aprGrid"
                //    && pVal.ColUID == "Documento"
                //    && pVal.BeforeAction)
                //    {
                //    BubbleEvent = false;
                //    SAPbouiCOM.Form objForm = MainObject.Instance.B1Application.Forms.Item(pVal.FormUID);
                //    SAPbouiCOM.DataTable objData = objForm.DataSources.DataTables.Item("BYB_RELIST");
                //    string strValue = Convert.ToString(objData.GetValue("Documento", pVal.Row));
                //    MainObject.Instance.B1Application.OpenForm(SAPbouiCOM.BoFormObjectEnum.fo_UserDefinedObject, "BYB_T1EXP600", strValue);
                //}

                if (pVal.EventType == SAPbouiCOM.BoEventTypes.et_ITEM_PRESSED &&
                    pVal.FormTypeEx == "BYB_REQAPR" &&
                    pVal.ItemUID == "btnUpdate" &&
                    !pVal.BeforeAction)
                {
                    Expenses.updateRequestStatus(pVal);
                }
                #endregion

                #region Desembolsos

                if (pVal.FormTypeEx == Settings._Main.PaymentFormType &&
                    pVal.EventType == SAPbouiCOM.BoEventTypes.et_CHOOSE_FROM_LIST &&
                    pVal.BeforeAction &&
                    pVal.ItemUID == "txtAcct"
                    )
                {
                    Expenses.filterAccountPaymentForm(pVal, false);
                }

                if (pVal.FormTypeEx == Settings._Main.PaymentFormType &&
                    pVal.EventType == SAPbouiCOM.BoEventTypes.et_CHOOSE_FROM_LIST &&
                    !pVal.BeforeAction &&
                    pVal.ItemUID == "txtAcct"
                    )
                {
                    Expenses.filterAccountPaymentForm(pVal, true);
                }

                if (pVal.EventType == SAPbouiCOM.BoEventTypes.et_ITEM_PRESSED &&
                    pVal.FormTypeEx == Settings._Main.PaymentFormType &&
                    pVal.ItemUID == "btnCreate" &&
                    !pVal.BeforeAction)
                {
                    Expenses.addPaymentDocument(pVal);
                }

                #endregion

                #region Legalizacion

                if (pVal.FormTypeEx == Settings._Main.LegalizationRequestUDoFormType &&
                    pVal.EventType == SAPbouiCOM.BoEventTypes.et_FORM_LOAD &&
                    !pVal.BeforeAction

                    )
                {
                    CacheManager.CacheManager.Instance.addToCache(Settings._Main.LegalizationFormLastId, pVal.FormUID, CacheManager.CacheManager.objCachePriority.Default);
                }



                if (pVal.FormTypeEx == Settings._Main.LegalizationRequestUDoFormType &&
                    pVal.EventType == SAPbouiCOM.BoEventTypes.et_CHOOSE_FROM_LIST &&
                    pVal.BeforeAction &&
                    pVal.ItemUID == "22_U_E"
                    )
                {
                    Expenses.filterValidRequestUDO(pVal, false);
                }

                if (pVal.FormTypeEx == Settings._Main.LegalizationRequestUDoFormType &&
                    pVal.EventType == SAPbouiCOM.BoEventTypes.et_CHOOSE_FROM_LIST &&
                    !pVal.BeforeAction &&
                    pVal.ItemUID == "22_U_E"
                    )
                {
                    Expenses.filterValidRequestUDO(pVal, true);
                }

                if (pVal.FormTypeEx == Settings._Main.LegalizationRequestUDoFormType &&
                    pVal.EventType == SAPbouiCOM.BoEventTypes.et_CHOOSE_FROM_LIST &&
                    pVal.BeforeAction &&
                    pVal.ItemUID == "0_U_G" &&
                    pVal.ColUID == "C_0_1"

                    )
                {
                    Expenses.filterValidConceptsUDO(pVal, false, out BubbleEvent);
                }

                if (pVal.FormTypeEx == Settings._Main.LegalizationRequestUDoFormType &&
                    pVal.EventType == SAPbouiCOM.BoEventTypes.et_CHOOSE_FROM_LIST &&
                    !pVal.BeforeAction &&
                    pVal.ItemUID == "0_U_G" &&
                    pVal.ColUID == "C_0_1"
                    )
                {
                    Expenses.filterValidConceptsUDO(pVal, true, out BubbleEvent);
                }

                if (pVal.FormTypeEx == Settings._Main.LegalizationRequestUDoFormType &&
                    pVal.EventType == SAPbouiCOM.BoEventTypes.et_CHOOSE_FROM_LIST &&
                    pVal.BeforeAction &&
                    pVal.ItemUID == "0_U_G" &&
                    pVal.ColUID == "C_0_5"

                    )
                {
                    Expenses.filterThirdPartyConceptsUDO(pVal, false, out BubbleEvent);
                }

                if (pVal.FormTypeEx == Settings._Main.LegalizationRequestUDoFormType &&
                    pVal.EventType == SAPbouiCOM.BoEventTypes.et_CHOOSE_FROM_LIST &&
                    !pVal.BeforeAction &&
                    pVal.ItemUID == "0_U_G" &&
                    pVal.ColUID == "C_0_5"
                    )
                {
                    Expenses.filterThirdPartyConceptsUDO(pVal, true, out BubbleEvent);
                }

                if (pVal.FormTypeEx == Settings._Main.LegalizationRequestUDoFormType &&
                    pVal.EventType == SAPbouiCOM.BoEventTypes.et_GOT_FOCUS &&
                    !pVal.BeforeAction &&
                    pVal.ItemUID == "0_U_G"
                    //&& pVal.ColUID == "C_0_2"
                    )
                {
                    Tuple <string, string, int> tLastGotFocusColumn = new Tuple <string, string, int>(pVal.ItemUID, pVal.ColUID, pVal.Row);
                    CacheManager.CacheManager.Instance.addToCache(pVal.FormUID + "_LastColumnFocus", tLastGotFocusColumn, CacheManager.CacheManager.objCachePriority.Default);
                    //MainObject.Instance.B1Application.SetStatusBarMessage(pVal.Row.ToString(),SAPbouiCOM.BoMessageTime.bmt_Short, false);
                    //Expenses.refreshLineInfo(pVal);
                }

                if (pVal.FormTypeEx == Settings._Main.LegalizationRequestUDoFormType &&
                    pVal.EventType == SAPbouiCOM.BoEventTypes.et_LOST_FOCUS &&
                    !pVal.BeforeAction &&
                    pVal.ItemUID == "0_U_G"

                    )
                {
                    Tuple <string, string, int> tLastGotFocusColumn = CacheManager.CacheManager.Instance.getFromCache(pVal.FormUID + "_LastColumnFocus");
                    if (tLastGotFocusColumn != null)
                    {
                        if (tLastGotFocusColumn.Item1 == "0_U_G" && tLastGotFocusColumn.Item2 == "C_0_3")
                        {
                            Expenses.refreshFormValues(pVal, tLastGotFocusColumn);
                        }
                    }
                }

                if (pVal.FormTypeEx == Settings._Main.LegalizationRequestUDoFormType &&
                    pVal.EventType == SAPbouiCOM.BoEventTypes.et_ITEM_PRESSED &&
                    !pVal.BeforeAction &&
                    pVal.ItemUID == "btnContab"

                    )
                {
                    Expenses.postLegalization(pVal);
                }



                #endregion

                #region Caja Menor

                #region Conceptos

                #region Concepts ChooseFromList BP

                if (pVal.FormTypeEx == Settings._MainPettyCash.pettyCashConceptUDOFormType &&
                    pVal.EventType == SAPbouiCOM.BoEventTypes.et_CHOOSE_FROM_LIST &&
                    pVal.ItemUID == "1_U_G" &&
                    !pVal.BeforeAction
                    )
                {
                    SAPbouiCOM.Form objForm = MainObject.Instance.B1Application.Forms.Item(pVal.FormUID);
                    PettyCash.loadBPNameCFL(objForm, pVal);
                }


                #endregion

                #region Filter Account CFL
                if (pVal.FormTypeEx == Settings._MainPettyCash.pettyCashConceptUDOFormType &&
                    pVal.EventType == SAPbouiCOM.BoEventTypes.et_CHOOSE_FROM_LIST &&
                    pVal.BeforeAction &&
                    pVal.ItemUID == "14_U_E"
                    )
                {
                    PettyCash.filterAccountConceptsUDO(pVal, false);
                }

                if (pVal.FormTypeEx == Settings._MainPettyCash.pettyCashConceptUDOFormType &&
                    pVal.EventType == SAPbouiCOM.BoEventTypes.et_CHOOSE_FROM_LIST &&
                    !pVal.BeforeAction &&
                    pVal.ItemUID == "14_U_E"
                    )
                {
                    PettyCash.filterAccountConceptsUDO(pVal, true);
                }
                #endregion
                #endregion

                #region Apertura

                if (pVal.FormTypeEx == Settings._MainPettyCash.pettyCashPaymentFormType &&
                    pVal.EventType == SAPbouiCOM.BoEventTypes.et_CHOOSE_FROM_LIST &&
                    pVal.BeforeAction &&
                    pVal.ItemUID == "Item_7"
                    )
                {
                    PettyCash.filterAccountPCPaymentForm(pVal, false);
                }

                if (pVal.FormTypeEx == Settings._MainPettyCash.pettyCashPaymentFormType &&
                    pVal.EventType == SAPbouiCOM.BoEventTypes.et_CHOOSE_FROM_LIST &&
                    !pVal.BeforeAction &&
                    pVal.ItemUID == "Item_7"
                    )
                {
                    PettyCash.filterAccountPCPaymentForm(pVal, true);
                }

                if (pVal.FormTypeEx == Settings._MainPettyCash.pettyCashPaymentFormType &&
                    pVal.EventType == SAPbouiCOM.BoEventTypes.et_CHOOSE_FROM_LIST &&
                    pVal.BeforeAction &&
                    pVal.ItemUID == "Item_8"
                    )
                {
                    PettyCash.filterPettyCashPCPaymentForm(pVal, false);
                }

                if (pVal.FormTypeEx == Settings._MainPettyCash.pettyCashPaymentFormType &&
                    pVal.EventType == SAPbouiCOM.BoEventTypes.et_CHOOSE_FROM_LIST &&
                    !pVal.BeforeAction &&
                    pVal.ItemUID == "Item_8"
                    )
                {
                    PettyCash.filterPettyCashPCPaymentForm(pVal, true);
                }

                if (pVal.FormTypeEx == Settings._MainPettyCash.pettyCashPaymentFormType &&
                    pVal.EventType == SAPbouiCOM.BoEventTypes.et_ITEM_PRESSED &&
                    !pVal.BeforeAction &&
                    pVal.ItemUID == "btnOpen"
                    )
                {
                    PettyCash.addPaymentDocument(pVal);
                }
                #endregion

                #region Legalizacion

                if (pVal.FormTypeEx == Settings._MainPettyCash.pettyCashLegalizationFormType &&
                    pVal.EventType == SAPbouiCOM.BoEventTypes.et_FORM_LOAD &&
                    !pVal.BeforeAction

                    )
                {
                    CacheManager.CacheManager.Instance.addToCache(Settings._Main.LegalizationFormLastId, pVal.FormUID, CacheManager.CacheManager.objCachePriority.Default);
                }

                if (pVal.FormTypeEx == Settings._MainPettyCash.pettyCashLegalizationFormType &&
                    pVal.EventType == SAPbouiCOM.BoEventTypes.et_CHOOSE_FROM_LIST &&
                    pVal.BeforeAction &&
                    pVal.ItemUID == "21_U_E"
                    )
                {
                    PettyCash.filterValidPCUDO(pVal, false);
                }

                if (pVal.FormTypeEx == Settings._MainPettyCash.pettyCashLegalizationFormType &&
                    pVal.EventType == SAPbouiCOM.BoEventTypes.et_CHOOSE_FROM_LIST &&
                    !pVal.BeforeAction &&
                    pVal.ItemUID == "21_U_E"
                    )
                {
                    PettyCash.filterValidPCUDO(pVal, true);
                }

                if (pVal.FormTypeEx == Settings._MainPettyCash.pettyCashLegalizationFormType &&
                    pVal.EventType == SAPbouiCOM.BoEventTypes.et_CHOOSE_FROM_LIST &&
                    pVal.ItemUID == "0_U_G" &&
                    pVal.ColUID == "C_0_1"
                    )
                {
                    PettyCash.setValidConceptInfo(pVal, out BubbleEvent);
                }



                if (pVal.FormTypeEx == Settings._MainPettyCash.pettyCashLegalizationFormType &&
                    pVal.EventType == SAPbouiCOM.BoEventTypes.et_CHOOSE_FROM_LIST &&
                    pVal.BeforeAction &&
                    pVal.ItemUID == "0_U_G" &&
                    pVal.ColUID == "C_0_5"

                    )
                {
                    PettyCash.filterThirdPartyConceptsUDO(pVal, false, out BubbleEvent);
                }

                if (pVal.FormTypeEx == Settings._MainPettyCash.pettyCashLegalizationFormType &&
                    pVal.EventType == SAPbouiCOM.BoEventTypes.et_CHOOSE_FROM_LIST &&
                    !pVal.BeforeAction &&
                    pVal.ItemUID == "0_U_G" &&
                    pVal.ColUID == "C_0_5"
                    )
                {
                    PettyCash.filterThirdPartyConceptsUDO(pVal, true, out BubbleEvent);
                }

                if (pVal.FormTypeEx == Settings._MainPettyCash.pettyCashLegalizationFormType &&
                    pVal.EventType == SAPbouiCOM.BoEventTypes.et_GOT_FOCUS &&
                    !pVal.BeforeAction &&
                    pVal.ItemUID == "0_U_G"
                    //&& pVal.ColUID == "C_0_2"
                    )
                {
                    Tuple <string, string> tLastGotFocusColumn = new Tuple <string, string>(pVal.ItemUID, pVal.ColUID);
                    CacheManager.CacheManager.Instance.addToCache(pVal.FormUID + "_LastColumnFocus", tLastGotFocusColumn, CacheManager.CacheManager.objCachePriority.Default);
                    //Expenses.refreshLineInfo(pVal);
                }

                if (pVal.FormTypeEx == Settings._MainPettyCash.pettyCashLegalizationFormType &&
                    pVal.EventType == SAPbouiCOM.BoEventTypes.et_LOST_FOCUS &&
                    !pVal.BeforeAction &&
                    pVal.ItemUID == "0_U_G"

                    )
                {
                    Tuple <string, string> tLastGotFocusColumn = CacheManager.CacheManager.Instance.getFromCache(pVal.FormUID + "_LastColumnFocus");
                    if (tLastGotFocusColumn != null)
                    {
                        if (tLastGotFocusColumn.Item1 == "0_U_G" && tLastGotFocusColumn.Item2 == "C_0_3")
                        {
                            PettyCash.refreshFormValues(pVal);
                        }
                    }
                }

                if (pVal.FormTypeEx == Settings._MainPettyCash.pettyCashLegalizationFormType &&
                    pVal.EventType == SAPbouiCOM.BoEventTypes.et_ITEM_PRESSED &&
                    !pVal.BeforeAction &&
                    pVal.ItemUID == "btnContab"

                    )
                {
                    PettyCash.postLegalization(pVal);
                }


                #endregion



                #endregion
            }
            catch (COMException comEx)
            {
                _Logger.Error("", comEx);
            }
            catch (Exception er)
            {
                _Logger.Error("", er);
            }
        }