예제 #1
0
        /// <summary>
        /// Inserts the ca receipt.
        /// </summary>
        /// <param name="receipt">The receipt.</param>
        /// <returns>System.String.</returns>
        public string InsertCAReceipt(CAReceiptEntity receipt)

        {
            const string procedures = @"uspInsert_CAReceipt";

            return(Db.Update(procedures, true, TakeInsert(receipt)));
        }
예제 #2
0
        /// <summary>
        /// Deletes the cash entity.
        /// </summary>
        /// <param name="receipt">The receipt.</param>
        /// <returns>System.String.</returns>
        public string DeleteCAReceipt(CAReceiptEntity receipt)
        {
            const string procedures = @"uspDelete_CAReceipt";

            object[] parms = { "@RefID", receipt.RefId };
            return(Db.Delete(procedures, true, parms));
        }
예제 #3
0
 private object[] TakeInsert(CAReceiptEntity cAReceiptEntity)
 {
     return(new object[]
     {
         "@RefId", cAReceiptEntity.RefId,
         "@RefType", cAReceiptEntity.RefType,
         "@RefDate", cAReceiptEntity.RefDate,
         "@PostedDate", cAReceiptEntity.PostedDate,
         "@RefNo", cAReceiptEntity.RefNo,
         "@CurrencyCode", cAReceiptEntity.CurrencyCode,
         "@ExchangeRate", cAReceiptEntity.ExchangeRate,
         "@ParalellRefNo", cAReceiptEntity.ParalellRefNo,
         "@OutwardRefNo", cAReceiptEntity.OutwardRefNo,
         "@AccountingObjectId", cAReceiptEntity.AccountingObjectId,
         "@JournalMemo", cAReceiptEntity.JournalMemo,
         "@DocumentIncluded", cAReceiptEntity.DocumentIncluded,
         "@InvType", cAReceiptEntity.InvType,
         "@InvDateOrWithdrawRefDate", cAReceiptEntity.InvDateOrWithdrawRefDate,
         "@InvSeries", cAReceiptEntity.InvSeries,
         "@InvNoOrWithdrawRefNo", cAReceiptEntity.InvNoOrWithdrawRefNo,
         "@BankId", cAReceiptEntity.BankId,
         "@TotalAmount", cAReceiptEntity.TotalAmount,
         "@TotalAmountOC", cAReceiptEntity.TotalAmountOC,
         "@TotalTaxAmount", cAReceiptEntity.TotalTaxAmount,
         "@TotalOutwardAmount", cAReceiptEntity.TotalOutwardAmount,
         "@Posted", cAReceiptEntity.Posted,
         "@RefOrder", cAReceiptEntity.RefOrder,
         "@InvoiceForm", cAReceiptEntity.InvoiceForm,
         "@InvoiceFormNumberId", cAReceiptEntity.InvoiceFormNumberId,
         "@InvSeriesPrefix", cAReceiptEntity.InvSeriesPrefix,
         "@InvSeriesSuffix", cAReceiptEntity.InvSeriesSuffix,
         "@PayForm", cAReceiptEntity.PayForm,
         "@CompanyTaxcode", cAReceiptEntity.CompanyTaxcode,
         "@RelationRefId", cAReceiptEntity.RelationRefId,
         "@BUCommitmentRequestId", cAReceiptEntity.BUCommitmentRequestId,
         "@AccountingObjectContactName", cAReceiptEntity.AccountingObjectContactName,
         "@ListNo", cAReceiptEntity.ListNo,
         "@ListDate", cAReceiptEntity.ListDate,
         "@IsAttachList", cAReceiptEntity.IsAttachList,
         "@ListCommonNameInventory", cAReceiptEntity.ListCommonNameInventory,
         "@TotalReceiptAmount", cAReceiptEntity.TotalReceiptAmount,
         "@BUPlanWithdrawRefID", cAReceiptEntity.BUPlanWithdrawRefId,
         "@Payer", cAReceiptEntity.Payer,
         "@Address", cAReceiptEntity.Address
     });
 }
        public List <CAReceiptEntity> GetCAReceipts(string connectionString)
        {
            List <CAReceiptEntity> buentity = new List <CAReceiptEntity>();

            using (var context = new MISAEntity(connectionString))
            {
                var querry           = context.CAReceiptDetails.ToList();
                var projects         = context.Projects.ToList();
                var currencys        = context.CCies.ToList();
                var budgetsource     = context.BudgetSources.ToList();
                var listitems        = context.ListItems.ToList();
                var funds            = context.Funds.ToList();
                var fundstructures   = context.FundStructures.ToList();
                var budgetproviders  = context.BudgetProvidences.ToList();
                var accountingobject = context.AccountingObjects.ToList();
                var projectexpenses  = context.ProjectExpenses.ToList();
                var activity         = context.Activities.ToList();
                var tasks            = context.Tasks.ToList();
                var topics           = context.Topics.ToList();
                banks = context.BankInfoes.ToList();
                var department        = context.Departments.ToList();
                var resultcontext     = context.CAReceipts.Where(x => x.RefType != 102).Where(x => x.RefType != 103).ToList();
                var fixedasset        = context.FixedAssets.ToList();
                var inventoryitems    = context.InventoryItems.ToList();
                var stocks            = context.Stocks.ToList();
                var invoiceformnumber = context.InvoiceFormNumbers.ToList();
                //Detail
                var parallel = context.CAReceiptDetailParallels.ToList();
                var sales    = context.CAReceiptDetailSales.ToList();
                var taxs     = context.CAReceiptDetailTaxes.ToList();
                foreach (var result in resultcontext)
                {
                    var newresult = new CAReceiptEntity();
                    newresult.RefId                       = result.RefID.ToString();
                    newresult.RefType                     = ConvRefType.ConvRefType(result.RefType);
                    newresult.RefDate                     = result.RefDate;
                    newresult.PostedDate                  = result.PostedDate;
                    newresult.RefNo                       = result.RefNo;
                    newresult.CurrencyCode                = result.CCY == null ? null : result.CCY.CurrencyID;
                    newresult.ExchangeRate                = result.ExchangeRate ?? 0;
                    newresult.ParalellRefNo               = result.ParalellRefNo;
                    newresult.OutwardRefNo                = result.OutwardRefNo;
                    newresult.AccountingObjectId          = result.AccountingObject == null ? null : result.AccountingObject.AccountingObjectID.ToString();
                    newresult.JournalMemo                 = result.JournalMemo;
                    newresult.DocumentIncluded            = result.DocumentIncluded;
                    newresult.InvType                     = result.InvType;
                    newresult.InvDateOrWithdrawRefDate    = result.InvDateOrWithdrawRefDate;
                    newresult.InvSeries                   = result.InvSeries;
                    newresult.InvNoOrWithdrawRefNo        = result.InvNoOrWithdrawRefNo;
                    newresult.BankId                      = result.BankAccount == null ? null : banks.FirstOrDefault(x => x.BankAccount == result.BankAccount).BankInfoID.ToString();
                    newresult.TotalAmount                 = result.TotalAmount;
                    newresult.TotalAmountOC               = result.TotalAmountOC;
                    newresult.TotalTaxAmount              = result.TotalTaxAmount;
                    newresult.TotalOutwardAmount          = result.TotalOutwardAmount;
                    newresult.Posted                      = result.Posted;
                    newresult.RefOrder                    = result.RefOrder;
                    newresult.InvoiceForm                 = result.InvoiceForm;
                    newresult.InvoiceFormNumberId         = result.InvoiceFormNumber == null ? null : result.InvoiceFormNumber.InvoiceFormNumberID.ToString();
                    newresult.InvSeriesPrefix             = result.InvSeriesPrefix;
                    newresult.InvSeriesSuffix             = result.InvSeriesSuffix;
                    newresult.PayForm                     = result.PayForm;
                    newresult.CompanyTaxcode              = result.ComPanyTaxcode;
                    newresult.RelationRefId               = result.RelationRefID.ToString();
                    newresult.BUCommitmentRequestId       = result.BUCommitmentRequestID.ToString();
                    newresult.AccountingObjectContactName = result.AccountingObjectContactName;
                    newresult.ListNo                      = result.ListNo;
                    newresult.ListDate                    = result.ListDate;
                    newresult.IsAttachList                = result.IsAttachList;
                    newresult.ListCommonNameInventory     = result.ListCommonNameInventory;
                    newresult.TotalReceiptAmount          = result.TotalReceiptAmount;
                    //newresult.WithdrawDate = result.WithdrawDate;
                    //newresult.WithdrawNo = result.WithdrawNo;
                    //newresult.CommitmentNo = result.CommitmentNo;
                    //newresult.BUPlanWithdrawRefId = result.BUPlanWithdrawRefID;

                    newresult.CAReceiptDetails         = result.CAReceiptDetails.Count <= 0 ? null : CAReceiptDetails(result.CAReceiptDetails.ToList(), result.RefID.ToString());
                    newresult.CAReceiptDetailParallels = result.CAReceiptDetailParallels.Count <= 0 ? null : CAReceiptDetailParallels(result.CAReceiptDetailParallels.ToList(), result.RefID.ToString());
                    newresult.CAReceiptDetailTaxes     = result.CAReceiptDetailTaxes.Count <= 0 ? null : CAReceiptDetailTaxes(result.CAReceiptDetailTaxes.ToList(), result.RefID.ToString());

                    buentity.Add(newresult);
                }
            }
            return(buentity);
        }