Пример #1
0
 private void FillMatrixAuction(List <AuctionsDTO> pLstAuctionDTO)
 {
     try
     {
         DtMatrixAuctions.Rows.Clear();
         int i = 0;
         this.UIAPIRawForm.Freeze(true);
         foreach (AuctionsDTO lObjAuction in pLstAuctionDTO)
         {
             DtMatrixAuctions.Rows.Add();
             DtMatrixAuctions.SetValue("#", i, i + 1);
             DtMatrixAuctions.SetValue("C_Auction", i, lObjAuction.Folio);
             DtMatrixAuctions.SetValue("C_TotalB", i, lObjAuction.TotalBuyer);
             DtMatrixAuctions.SetValue("C_TotalC", i, lObjAuction.TotalCharge == null ? "0" : lObjAuction.TotalCharge);
             i++;
         }
         mtxAuction.Columns.Item("#").DataBind.Bind("DsAuctions", "#");
         mtxAuction.Columns.Item("C_Auction").DataBind.Bind("DsAuctions", "C_Auction");
         mtxAuction.Columns.Item("C_TotalB").DataBind.Bind("DsAuctions", "C_TotalB");
         mtxAuction.Columns.Item("C_TotalC").DataBind.Bind("DsAuctions", "C_TotalC");
         mtxAuction.LoadFromDataSource();
         mtxAuction.AutoResizeColumns();
     }
     catch (Exception ex)
     {
         UIApplication.ShowError("frmPayment (FillMatrixAuction) " + ex.Message);
         LogService.WriteError("frmPayment (FillMatrixAuction) " + ex.Message);
         LogService.WriteError(ex);
     }
     finally
     {
         this.UIAPIRawForm.Freeze(false);
     }
 }
Пример #2
0
        private void UpdateMatrix()
        {
            try
            {
                this.UIAPIRawForm.Freeze(true);
                decimal lDecPaymentPayment = 0;
                for (int i = 0; i < DtMatrixAuctions.Rows.Count; i++)
                {
                    string  lStrPayment = (mtxAuction.Columns.Item("C_TotalC").Cells.Item(i + 1).Specific as EditText).Value.Trim();
                    decimal lDblPayment = Convert.ToDecimal(lStrPayment == "" ? "0" : lStrPayment);
                    DtMatrixAuctions.SetValue("C_TotalC", i, lDblPayment.ToString());
                    lDecPaymentPayment += lDblPayment;
                }
                decimal lDecPaymentSell = Convert.ToDecimal(DtMatrixSellers.GetValue("C_TotalS", mIntRowSelected - 1).ToString());
                DtMatrixSellers.SetValue("C_TotalC", mIntRowSelected - 1, lDecPaymentPayment.ToString());

                DtMatrixSellers.SetValue("C_Total", mIntRowSelected - 1, (lDecPaymentSell - lDecPaymentPayment).ToString());
                mtxSellers.LoadFromDataSource();
                mtxAuction.LoadFromDataSource();
            }
            catch (Exception ex)
            {
                UIApplication.ShowError("frmPayment (UpdateMatrix) " + ex.Message);
                LogService.WriteError("frmPayment (UpdateMatrix) " + ex.Message);
                LogService.WriteError(ex);
            }
            finally
            {
                this.UIAPIRawForm.Freeze(false);
            }
        }
Пример #3
0
        private void mtxAuction_ValidateBefore(object sboObject, SAPbouiCOM.SBOItemEventArg pVal, out bool BubbleEvent)
        {
            BubbleEvent = true;
            try
            {
                if (pVal.ColUID == "C_TotalC")
                {
                    string lStrPayment = (mtxAuction.Columns.Item("C_TotalC").Cells.Item(pVal.Row).Specific as EditText).Value.Trim();

                    decimal lDblPayment = Convert.ToDecimal(lStrPayment == "" ? "0" : lStrPayment);
                    decimal lDblCompra  = Convert.ToDecimal(DtMatrixAuctions.GetValue("C_TotalB", pVal.Row - 1));

                    if (lDblPayment <= lDblCompra && lDblPayment >= 0)
                    {
                        UpdateMatrix();
                        JounralEntry(pVal.Row);
                    }
                    else
                    {
                        BubbleEvent = false;
                        UIApplication.ShowError("Cantidad incorrecta favor de revisar");
                    }
                }
            }
            catch (Exception ex)
            {
                UIApplication.ShowError("frmPayment (mtxAuction_ValidateBefore) " + ex.Message);
                LogService.WriteError("frmPayment (mtxAuction_ValidateBefore) " + ex.Message);
                LogService.WriteError(ex);
            }
        }
Пример #4
0
 private void JounralEntry(int pIntRow)
 {
     try
     {
         string  lStrAuction = DtMatrixAuctions.GetValue("C_Auction", pIntRow - 1).ToString();
         string  lStrAux     = DtMatrixSellers.GetValue("C_Code", mIntRowSelected - 1).ToString();
         decimal lDecTotalC  = Convert.ToDecimal(DtMatrixAuctions.GetValue("C_TotalC", pIntRow - 1).ToString());
         if (lDecTotalC > 0)
         {
             JournalEntryDTO lObjJournalEntry = mLstJournalEntryDTO.Where(x => x.Aux == lStrAux && x.AuctionId == lStrAuction).FirstOrDefault();
             if (lObjJournalEntry == null)
             {
                 JournalEntryDTO lObjJournalEntryDTO = new JournalEntryDTO();
                 lObjJournalEntryDTO.AuctionId = DtMatrixAuctions.GetValue("C_Auction", pIntRow - 1).ToString();
                 lObjJournalEntryDTO.Credit    = Convert.ToDecimal(DtMatrixAuctions.GetValue("C_TotalC", pIntRow - 1).ToString());
                 lObjJournalEntryDTO.Debit     = 0;
                 lObjJournalEntryDTO.Area      = "SU_HERMO";
                 lObjJournalEntryDTO.AuxType   = "1";
                 lObjJournalEntryDTO.Aux       = DtMatrixSellers.GetValue("C_Code", mIntRowSelected - 1).ToString();
                 lObjJournalEntryDTO.AuctionId = DtMatrixAuctions.GetValue("C_Auction", pIntRow - 1).ToString();
                 lObjJournalEntryDTO.Account   = DtMatrixSellers.GetValue("C_AccountC", mIntRowSelected - 1).ToString();
                 lObjJournalEntry = lObjJournalEntryDTO;
                 mLstJournalEntryDTO.Add(lObjJournalEntryDTO);
             }
             else
             {
                 lObjJournalEntry.Credit = Convert.ToDecimal(DtMatrixAuctions.GetValue("C_TotalC", pIntRow - 1).ToString());
             }
             UpdateJorunalEntryDebit(lObjJournalEntry);
         }
     }
     catch (Exception ex)
     {
         UIApplication.ShowError("frmPayment (JounralEntry) " + ex.Message);
         LogService.WriteError("frmPayment (JounralEntry) " + ex.Message);
         LogService.WriteError(ex);
     }
 }