public void SaveCancelBookinginCustomerTransaction(TblBookingCancelMaster master)
        {
            if (master.PkId > 0)
            {
                var entity = this.ktConContext.TblCustomerTransaction.FirstOrDefault(item => item.CustomerId == master.CustomerId && item.BookingId == master.RecordNo.ToString() && item.TransactionType == typeof(TblBookingCancelMaster).ToString());

                if (entity != null)
                {
                    entity.CancelBookingAmt = master.PaidAmount;
                    ktConContext.TblCustomerTransaction.Update(entity);
                    ktConContext.SaveChanges();
                }
            }
            else
            {
                TblCustomerTransaction custransList = new TblCustomerTransaction()
                {
                    CustomerId         = master.CustomerId,
                    TransactionDate    = master.BookungCancelDate,
                    TransactionType    = typeof(TblBookingCancelMaster).ToString(),
                    BookingId          = master.RecordNo.ToString(),
                    BookingAmount      = 0,
                    BookingReceivedAmt = 0,
                    CancelBookingAmt   = master.PaidAmount,
                    BillId             = "0",
                    BillAmount         = 0,
                    BillPaidAmt        = 0,
                    PaymentType        = master.PaymentMethod,
                    Narration          = master.Narration,
                    ReceiptNo          = "0"
                };
                this.RepositoryContext.Set <TblCustomerTransaction>().Add(custransList);
                this.RepositoryContext.SaveChanges();
            }
        }
        public ActionResult DeleteConfirmed(int id)
        {
            TblCustomerTransaction tblCustomerTransaction = db.TblCustomerTransactions.Find(id);

            db.TblCustomerTransactions.Remove(tblCustomerTransaction);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
 public ActionResult Edit([Bind(Include = "Transction_ID,Transaction_Date,Transaction_type_id,Debit,Credit,Customer_ID,UserID,Description,Due_Date,Status,Note,User_ID")] TblCustomerTransaction tblCustomerTransaction)
 {
     if (ModelState.IsValid)
     {
         db.Entry(tblCustomerTransaction).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(tblCustomerTransaction));
 }
Beispiel #4
0
        public void SaveCustomerTransaction(TblSalesReceipt master)
        {
            decimal?bookReceiptAmt = 0;
            decimal?billPaidAmt    = 0;

            if (master.PaymentType == "Against Booking")
            {
                bookReceiptAmt = master.CashAmount;
                billPaidAmt    = 0;
            }
            else
            {
                bookReceiptAmt = 0;
                billPaidAmt    = master.CashAmount;
            }

            if (master.PkId > 0)
            {
                var entity = this.ktConContext.TblCustomerTransactions.FirstOrDefault(item => item.ReceiptNo == master.ReceiptNo.ToString() && item.TransactionType == typeof(TblSalesReceipt).ToString());

                if (entity != null)
                {
                    entity.BookingReceivedAmt = bookReceiptAmt;
                    entity.BillPaidAmt        = billPaidAmt;
                    entity.CancelBookingAmt   = 0;
                    ktConContext.TblCustomerTransactions.Update(entity);
                    ktConContext.SaveChanges();
                }
            }
            else
            {
                TblCustomerTransaction custransList = new TblCustomerTransaction()
                {
                    CustomerId         = master.CustomerId,
                    TransactionDate    = master.Date,
                    TransactionType    = typeof(TblSalesReceipt).ToString(),
                    BookingId          = "0",
                    BookingAmount      = 0,
                    CancelBookingAmt   = 0,
                    BookingReceivedAmt = bookReceiptAmt,
                    BillId             = "0",
                    BillAmount         = 0,
                    BillPaidAmt        = billPaidAmt,
                    PaymentType        = master.PaymentType,
                    Narration          = master.Narration,
                    ReceiptNo          = master.ReceiptNo.ToString(),
                };

                this.RepositoryContext.Set <TblCustomerTransaction>().Add(custransList);
                this.RepositoryContext.SaveChanges();
            }
        }
        // GET: TblCustomerTransactions/Delete/6
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            TblCustomerTransaction tblCustomerTransaction = db.TblCustomerTransactions.Find(id);

            if (tblCustomerTransaction == null)
            {
                return(HttpNotFound());
            }
            return(View(tblCustomerTransaction));
        }