예제 #1
0
        public int InsertPurchaseInvoice(EntityDebitNote entPurchaseInvoice, List <EntityDebitNoteDetails> lstInvoice)
        {
            try
            {
                int?id = 0;
                objData.STP_Insert_DebitNote(Convert.ToDateTime(entPurchaseInvoice.DNDate), Convert.ToInt32(entPurchaseInvoice.SupplierId), false, Convert.ToDecimal(entPurchaseInvoice.Amount), Convert.ToDecimal(entPurchaseInvoice.NetAmount), Convert.ToInt32(entPurchaseInvoice.Tax1), Convert.ToInt32(entPurchaseInvoice.Tax2), Convert.ToInt32(entPurchaseInvoice.Discount), ref id);
                foreach (EntityDebitNoteDetails item in lstInvoice)
                {
                    tblDebitNoteDetail obj = new tblDebitNoteDetail()
                    {
                        DNNo        = id,
                        ProductCode = item.ProductCode,
                        Quantity    = item.Quantity,
                        Price       = item.Price,
                        Amount      = item.Amount,
                        BatchNo     = item.BatchNo,
                        ExpiryDate  = item.ExpiryDate,
                        IsDelete    = false
                    };
                    tblStockDetail objStock = new tblStockDetail()
                    {
                        OpeningQty      = 0,
                        InwardQty       = 0,
                        InwardPrice     = 0,
                        InwardAmount    = 0,
                        BatchNo         = item.BatchNo,
                        ExpiryDate      = item.ExpiryDate,
                        OutwardQty      = item.Quantity,
                        OutwardPrice    = item.Price,
                        DocumentNo      = id,
                        IsDelete        = false,
                        ProductId       = Convert.ToInt32(item.ProductCode),
                        TransactionType = "DebitNote",
                        OutwardAmount   = item.Amount
                    };
                    objData.tblStockDetails.InsertOnSubmit(objStock);
                    objData.tblDebitNoteDetails.InsertOnSubmit(obj);
                }
                int TId = new PatientInvoiceBLL().GetTransactionId();

                tblCustomerTransaction objCust = new tblCustomerTransaction()
                {
                    PayAmount        = entPurchaseInvoice.NetAmount,
                    IsCash           = false,
                    IsDelete         = false,
                    SupplierId       = entPurchaseInvoice.SupplierId,
                    ReceiptDate      = entPurchaseInvoice.DNDate,
                    TransactionDocNo = id,
                    TransactionId    = TId,
                    TransactionType  = "DebitNote"
                };
                objData.tblCustomerTransactions.InsertOnSubmit(objCust);
                objData.SubmitChanges();
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(1);
        }
예제 #2
0
        public int Save(EntityCustomerTransaction entCust, bool IsCash)
        {
            int TransactionId = new PatientInvoiceBLL().GetTransactionId();
            int ReceiptNo     = GetReceiptNo();

            if (IsCash)
            {
                tblCustomerTransaction objDebit = new tblCustomerTransaction()
                {
                    ReceiptDate      = entCust.ReceiptDate,
                    PatientId        = entCust.PatientId,
                    TransactionId    = TransactionId,
                    TransactionType  = "Refund",
                    TransactionDocNo = ReceiptNo,
                    IsCash           = true,
                    BillAmount       = entCust.BillAmount,
                    PayAmount        = 0,
                    IsDelete         = false,
                };
                objData.tblCustomerTransactions.InsertOnSubmit(objDebit);
            }
            else
            {
                tblCustomerTransaction objDebit = new tblCustomerTransaction()
                {
                    ReceiptDate      = entCust.ReceiptDate,
                    PatientId        = entCust.PatientId,
                    TransactionId    = TransactionId,
                    TransactionType  = "Refund",
                    TransactionDocNo = ReceiptNo,
                    ISCheque         = true,
                    BillAmount       = entCust.BillAmount,
                    PayAmount        = 0,
                    ChequeDate       = entCust.ReceiptDate,
                    ChequeNo         = entCust.ChequeNo,
                    BankName         = entCust.BankName,
                    IsDelete         = false,
                };
                objData.tblCustomerTransactions.InsertOnSubmit(objDebit);
            }
            objData.SubmitChanges();
            return(1);
        }
예제 #3
0
        public int InsertPurchaseInvoice(EntityPurchaseInvoice entPurchaseInvoice, List<EntityPurchaseInvoiceDetails> lstInvoice)
        {
            try
            {
                int? id = 0;
                bool flagISPOComplete = false;
                objData.STP_Insert_PurchaseInvoice(Convert.ToDateTime(entPurchaseInvoice.PIDate), Convert.ToInt32(entPurchaseInvoice.PONo), Convert.ToInt32(entPurchaseInvoice.SupplierId), false, Convert.ToDecimal(entPurchaseInvoice.Amount), Convert.ToInt32(entPurchaseInvoice.Tax1), Convert.ToInt32(entPurchaseInvoice.Tax2), Convert.ToInt32(entPurchaseInvoice.Discount), ref id);
                foreach (EntityPurchaseInvoiceDetails item in lstInvoice)
                {
                    tblPurchaseInvoiceDetail obj = new tblPurchaseInvoiceDetail()
                    {
                        PINo = id,
                        ProductCode = item.ProductCode,
                        InvoiceQty = item.InvoiceQty,
                        InvoicePrice = item.InvoicePrice,
                        Amount = item.Amount,
                        BatchNo = item.BatchNo,
                        ExpiryDate = item.ExpiryDate,
                        IsDelete = false
                    };
                    tblPurchaseOrderDetail orderItem = (from tbl in objData.tblPurchaseOrderDetails
                                                        where tbl.IsDelete == false
                                                        && tbl.PO_Id == entPurchaseInvoice.PONo
                                                        && tbl.Product_Id == item.ProductCode
                                                        select tbl).FirstOrDefault();
                    if (orderItem != null)
                    {
                        if (orderItem.Quantity == item.InvoiceQty)
                        {
                            flagISPOComplete = true;
                        }
                        else
                        {
                            flagISPOComplete = false;
                        }
                        orderItem.InvoiceQuantity = item.InvoiceQty;
                    }
                    tblStockDetail objStock = new tblStockDetail()
                    {
                        BatchNo = item.BatchNo,
                        ExpiryDate = item.ExpiryDate,
                        InwardPrice = item.InvoicePrice,
                        InwardQty = item.InvoiceQty,
                        DocumentNo = id,
                        IsDelete = false,
                        ProductId = Convert.ToInt32(item.ProductCode),
                        TransactionType = "PInvoice",
                        InwardAmount = item.Amount
                    };
                    objData.tblStockDetails.InsertOnSubmit(objStock);
                    objData.tblPurchaseInvoiceDetails.InsertOnSubmit(obj);
                }
                int TId = new PatientInvoiceBLL().GetTransactionId();
                tblPurchaseOrder po = (from tbl in objData.tblPurchaseOrders
                                       where tbl.IsDelete == false
                                       && tbl.PO_Id == entPurchaseInvoice.PONo
                                       select tbl).FirstOrDefault();

                if (po != null)
                {
                    List<EntityProduct> lstProducts = GetPOProduct(Convert.ToInt32(entPurchaseInvoice.PONo));
                    if (lstProducts.Count == lstInvoice.Count)
                    {
                        flagISPOComplete = true;
                    }
                    else
                    {
                        flagISPOComplete = false;
                    }
                    po.IsPOComplete = flagISPOComplete;
                }
                tblCustomerTransaction objCust = new tblCustomerTransaction()
                {
                    BillAmount = entPurchaseInvoice.Amount,
                    IsCash = false,
                    IsDelete = false,
                    SupplierId = entPurchaseInvoice.SupplierId,
                    ReceiptDate = entPurchaseInvoice.PIDate,
                    TransactionDocNo = id,
                    TransactionId = TId,
                    TransactionType = "PInvoice"
                };
                objData.tblCustomerTransactions.InsertOnSubmit(objCust);
                objData.SubmitChanges();
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return 1;
        }
예제 #4
0
        public int Save(List <TestAllocation> lst, tblTestInvoice obj, bool IsCash)
        {
            int?Id = 0;

            objData.STP_Insert_tblTestInvoice(Convert.ToDateTime(DateTime.Now.Date), ref Id, Convert.ToInt32(obj.PatientId), Convert.ToDecimal(obj.Amount), Convert.ToDecimal(obj.Discount));
            foreach (TestAllocation item in lst)
            {
                tblTestInvoiceDetail objtestDetails = new tblTestInvoiceDetail()
                {
                    TestInvoiceId = Convert.ToInt32(Id),
                    TestId        = item.TestId,
                    IsDelete      = false,
                    Charges       = Convert.ToDecimal(item.Charges)
                };
                objData.tblTestInvoiceDetails.InsertOnSubmit(objtestDetails);
            }
            int TransactionId = new PatientInvoiceBLL().GetTransactionId();

            if (IsCash)
            {
                tblCustomerTransaction objDebit = new tblCustomerTransaction()
                {
                    TransactionId    = TransactionId,
                    IsCash           = true,
                    TransactionDocNo = Id,
                    TransactionType  = "TestInvoice",
                    BillAmount       = obj.Amount,
                    PayAmount        = 0,
                    PatientId        = obj.PatientId,
                    IsDelete         = false,
                    ReceiptDate      = obj.TestInvoiceDate,
                };
                objData.tblCustomerTransactions.InsertOnSubmit(objDebit);
                //objData.SubmitChanges();
                tblCustomerTransaction objCrReceipt = new tblCustomerTransaction()
                {
                    TransactionId    = TransactionId,
                    IsCash           = true,
                    TransactionDocNo = Id,
                    TransactionType  = "TestInvoice",
                    PayAmount        = obj.Amount,
                    BillAmount       = 0,
                    PatientId        = obj.PatientId,
                    IsDelete         = false,
                    ReceiptDate      = obj.TestInvoiceDate,
                };
                objData.tblCustomerTransactions.InsertOnSubmit(objCrReceipt);
                //objData.SubmitChanges();
            }
            else
            {
                tblCustomerTransaction objDebit = new tblCustomerTransaction()
                {
                    TransactionId    = TransactionId,
                    IsCash           = false,
                    TransactionDocNo = Id,
                    TransactionType  = "TestInvoice",
                    BillAmount       = obj.Amount,
                    PatientId        = obj.PatientId,
                    IsDelete         = false,
                    ReceiptDate      = obj.TestInvoiceDate,
                };
                objData.tblCustomerTransactions.InsertOnSubmit(objDebit);
                //objData.SubmitChanges();
            }
            objData.SubmitChanges();
            return(1);
        }
예제 #5
0
 public int InsertInvoice(EntityICUInvoice entInvoice, List <EntityICUInvoiceDetail> lstInvoice, bool IsCash)
 {
     try
     {
         int?ICUInvoiceNo = 0;
         objData.STP_InserttblICUInvoiceDischarge(Convert.ToDateTime(entInvoice.AllocationDate), Convert.ToInt32(entInvoice.PatientId)
                                                  , Convert.ToDecimal(entInvoice.NetAmount), Convert.ToDecimal(entInvoice.TotalAmount),
                                                  Convert.ToInt32(entInvoice.Discount), Convert.ToInt32(entInvoice.Tax1), Convert.ToInt32(entInvoice.Tax2), false, Convert.ToBoolean(entInvoice.Is_ShiftIPD),
                                                  Convert.ToDateTime(entInvoice.ShiftDate), ref ICUInvoiceNo);
         foreach (EntityICUInvoiceDetail item in lstInvoice)
         {
             tblICUInvoiceDischargeDetail obj = new tblICUInvoiceDischargeDetail()
             {
                 ICUBedAllocId = entInvoice.ICUBedAllocId,
                 IsDelete      = false,
                 ChargesId     = item.ChargesId,
                 Amount        = item.Amount,
                 NoofDays      = item.NoofDays,
                 Charge        = item.Charges,
                 Quantity      = item.Quantity,
                 ICUInvoiceNo  = ICUInvoiceNo,
             };
             objData.tblICUInvoiceDischargeDetails.InsertOnSubmit(obj);
         }
         int TransactionId = new PatientInvoiceBLL().GetTransactionId();
         if (IsCash)
         {
             tblCustomerTransaction objDebit = new tblCustomerTransaction()
             {
                 TransactionId    = TransactionId,
                 IsCash           = true,
                 TransactionDocNo = ICUInvoiceNo,
                 TransactionType  = "ICUInvoice",
                 BillAmount       = entInvoice.NetAmount,
                 PayAmount        = 0,
                 PatientId        = entInvoice.PatientId,
                 IsDelete         = false,
                 ReceiptDate      = entInvoice.AllocationDate,
             };
             objData.tblCustomerTransactions.InsertOnSubmit(objDebit);
             //objData.SubmitChanges();
             tblCustomerTransaction objCrReceipt = new tblCustomerTransaction()
             {
                 TransactionId    = TransactionId,
                 IsCash           = true,
                 TransactionDocNo = ICUInvoiceNo,
                 TransactionType  = "ICUInvoice",
                 PayAmount        = entInvoice.NetAmount,
                 BillAmount       = 0,
                 PatientId        = entInvoice.PatientId,
                 IsDelete         = false,
                 ReceiptDate      = entInvoice.AllocationDate,
             };
             objData.tblCustomerTransactions.InsertOnSubmit(objCrReceipt);
             //objData.SubmitChanges();
         }
         else
         {
             tblCustomerTransaction objDebit = new tblCustomerTransaction()
             {
                 TransactionId    = TransactionId,
                 IsCash           = false,
                 TransactionDocNo = ICUInvoiceNo,
                 TransactionType  = "ICUInvoice",
                 BillAmount       = entInvoice.NetAmount,
                 PatientId        = entInvoice.PatientId,
                 IsDelete         = false,
                 ReceiptDate      = entInvoice.AllocationDate,
             };
             objData.tblCustomerTransactions.InsertOnSubmit(objDebit);
             //objData.SubmitChanges();
         }
         objData.SubmitChanges();
         return(1);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
예제 #6
0
        public void InsertData(tblInsuranceClaim tblins, EntityCustomerTransaction objPatient, EntityCustomerTransaction objBank, bool IsCash, bool IsNeft, bool IsCheque)
        {
            try
            {
                tblInsuranceClaim objcurrent = (from tbl in objData.tblInsuranceClaims
                                                where tbl.ClaimId == tblins.ClaimId
                                                select tbl).FirstOrDefault();
                if (objcurrent != null)
                {
                    objcurrent.ApprovedAmount = tblins.ApprovedAmount;
                    objcurrent.ApprovedDate   = tblins.ApprovedDate;
                    objcurrent.IsApproved     = tblins.IsApproved;
                    objcurrent.TDS            = tblins.TDS;
                    //objcurrent.Discount = tblins.Discount;
                    int TransactionId = new PatientInvoiceBLL().GetTransactionId();
                    if (IsCash)
                    {
                        tblCustomerTransaction tblcust = new tblCustomerTransaction()
                        {
                            TransactionId    = TransactionId,
                            IsCash           = true,
                            ISCheque         = false,
                            TransactionDocNo = objPatient.TransactionDocNo,
                            TransactionType  = "Claim",
                            BillAmount       = 0,
                            PayAmount        = objPatient.PayAmount,
                            PatientId        = objPatient.PatientId,
                            IsDelete         = false,
                            ReceiptDate      = objPatient.ReceiptDate,
                        };
                        objData.tblCustomerTransactions.InsertOnSubmit(tblcust);
                    }
                    else if (IsNeft)
                    {
                        tblCustomerTransaction tblcust = new tblCustomerTransaction()
                        {
                            TransactionId    = TransactionId,
                            IsCash           = false,
                            ISCheque         = false,
                            TransactionDocNo = objPatient.TransactionDocNo,
                            TransactionType  = "Claim",
                            BillAmount       = 0,
                            PayAmount        = objPatient.PayAmount,
                            PatientId        = objPatient.PatientId,
                            IsDelete         = false,
                            ReceiptDate      = objPatient.ReceiptDate,
                        };
                        objData.tblCustomerTransactions.InsertOnSubmit(tblcust);
                        tblCustomerTransaction tblcustBank = new tblCustomerTransaction()
                        {
                            TransactionId    = TransactionId,
                            IsCash           = false,
                            ISCheque         = false,
                            TransactionDocNo = objBank.TransactionDocNo,
                            TransactionType  = "Claim",
                            BillAmount       = objBank.BillAmount,
                            PayAmount        = 0,
                            PatientId        = 0,
                            IsDelete         = false,
                            ReceiptDate      = objBank.ReceiptDate,
                            BankId           = objBank.BankId
                        };
                        objData.tblCustomerTransactions.InsertOnSubmit(tblcustBank);
                    }
                    else if (IsCheque)
                    {
                        tblCustomerTransaction tblcust = new tblCustomerTransaction()
                        {
                            TransactionId    = TransactionId,
                            IsCash           = false,
                            ISCheque         = true,
                            TransactionDocNo = objPatient.TransactionDocNo,
                            TransactionType  = "Claim",
                            BillAmount       = 0,
                            PayAmount        = objPatient.PayAmount,
                            PatientId        = objPatient.PatientId,
                            IsDelete         = false,
                            ReceiptDate      = objPatient.ReceiptDate,
                        };
                        objData.tblCustomerTransactions.InsertOnSubmit(tblcust);
                        tblCustomerTransaction tblcustnew = new tblCustomerTransaction()
                        {
                            TransactionId    = TransactionId,
                            IsCash           = false,
                            ISCheque         = true,
                            TransactionDocNo = objBank.TransactionDocNo,
                            TransactionType  = "Claim",
                            BillAmount       = objBank.BillAmount,
                            PayAmount        = 0,
                            PatientId        = 0,
                            IsDelete         = false,
                            ReceiptDate      = objBank.ReceiptDate,
                            BankName         = objBank.BankName,
                            ChequeDate       = objBank.ChequeDate,
                            ChequeNo         = objBank.ChequeNo
                        };
                        objData.tblCustomerTransactions.InsertOnSubmit(tblcustnew);
                    }
                }

                objData.SubmitChanges();
            }
            catch (Exception)
            {
                throw;
            }
        }