Esempio n. 1
0
        private void LoadPayablePaymentItems(Guid id)
        {
            var payablePaymentItems = payablePaymentItemRepository.GetByPayablePaymentId(id);

            lvwPayablePayment.Items.Clear();

            decimal cash       = 0;
            decimal bank       = 0;
            decimal giro       = 0;
            decimal correction = 0;
            decimal total      = 0;

            foreach (var payablePaymentItem in payablePaymentItems)
            {
                cash       = cash + payablePaymentItem.Cash;
                bank       = bank + payablePaymentItem.Bank;
                giro       = giro + payablePaymentItem.Giro;
                correction = correction + payablePaymentItem.Correction;

                total = total + (payablePaymentItem.Cash + payablePaymentItem.Bank + payablePaymentItem.Giro + payablePaymentItem.Correction);
                PopulatePayablePaymentItem(payablePaymentItem);
            }

            lblCash.Text       = cash.ToString("N0").Replace(",", ".");
            lblBank.Text       = bank.ToString("N0").Replace(",", ".");
            lblGiro.Text       = giro.ToString("N0").Replace(",", ".");
            lblCorrection.Text = correction.ToString("N0").Replace(",", ".");
            lblTotal.Text      = total.ToString("N0").Replace(",", ".");
        }
        public PayablePayment GetById(Guid id)
        {
            PayablePayment payablePayment = null;

            using (var em = EntityManagerFactory.CreateInstance(ds))
            {
                string sql = "SELECT p.ID, p.PaymentCode, p.PaymentDate, "
                             + "p.TotalCash, p.TotalBank, p.TotalGiro, p.TotalCorrection, p.GrandTotal, p.Notes, "
                             + "p.CreatedDate,p.ModifiedDate, p.CreatedBy, p.ModifiedBy "
                             + "FROM PayablePayment p "
                             + "WHERE "
                             + "p.ID='{" + id + "}'";

                payablePayment = em.ExecuteObject <PayablePayment>(sql, new PayablePaymentMapper());

                if (payablePayment != null)
                {
                    payablePayment.PayablePaymentItems = payablePaymentItemRepository.GetByPayablePaymentId(payablePayment.ID);
                }
            }

            return(payablePayment);
        }