コード例 #1
0
        public List <DueListItem> DueAmountList(int invoice, int down, int installment_no, int installment_amount, DateTime fDate, int schedule)
        {
            int dueAmount  = installment_amount;
            int lastAmount = (invoice - down) - dueAmount * (installment_no - 1);

            List <DueListItem> result = new List <DueListItem>();

            for (int i = 0; i < installment_no; i++)
            {
                DueListItem item = new DueListItem();
                item.date = DueDateList(fDate, schedule, i);
                if (i == installment_no - 1)
                {
                    item.value = lastAmount;
                }
                else
                {
                    item.value = dueAmount;
                }

                result.Add(item);
            }

            return(result);
        }
コード例 #2
0
        public DueListItem updateDuePaymentMonthRow(UpdateDuePayment data)
        {
            string date  = utils.DateTimeToSQLDateString(data.paid_date);
            string query = "UPDATE pay_status SET paid_amount=" + data.paid_amount +
                           ", paid_date='" + date + "' WHERE id=" + data.id + ";";

            try
            {
                conn.Open();
                MySqlCommand cmd       = new MySqlCommand(query, conn);
                int          IsUpdated = cmd.ExecuteNonQuery();
                DueListItem  item      = new DueListItem();
                if (IsUpdated > 0)
                {
                    item.date  = date;
                    item.value = data.paid_amount;
                }
                return(item);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                conn.Close();
            }
        }