Example #1
0
        /// <summary>
        /// Inserts the ca inwardOutward.
        /// </summary>
        /// <param name="inwardOutward">The inwardOutward.</param>
        /// <returns>System.String.</returns>
        public string InsertINInwardOutward(INInwardOutwardEntity inwardOutward)

        {
            const string procedures = @"uspInsert_INInwardOutward";

            return(Db.Update(procedures, true, Take(inwardOutward)));
        }
Example #2
0
        /// <summary>
        /// Deletes the cash entity.
        /// </summary>
        /// <param name="inwardOutward">The inwardOutward.</param>
        /// <returns>System.String.</returns>
        public string DeleteINInwardOutward(INInwardOutwardEntity inwardOutward)
        {
            const string procedures = @"uspDelete_INInwardOutward";

            object[] parms = { "@RefID", inwardOutward.RefId };
            return(Db.Delete(procedures, true, parms));
        }
Example #3
0
 /// <summary>
 /// Takes the specified i n inward outward entity.
 /// </summary>
 /// <param name="iNInwardOutwardEntity">The i n inward outward entity.</param>
 /// <returns>System.Object[].</returns>
 private object[] Take(INInwardOutwardEntity iNInwardOutwardEntity)
 {
     return(new object[]
     {
         "@RefID", iNInwardOutwardEntity.RefId,
         "@RefType", iNInwardOutwardEntity.RefType,
         "@RefDate", iNInwardOutwardEntity.RefDate,
         "@PostedDate", iNInwardOutwardEntity.PostedDate,
         "@RefNo", iNInwardOutwardEntity.RefNo,
         "@ParalellRefNo", iNInwardOutwardEntity.ParalellRefNo,
         "@AccountingObjectID", iNInwardOutwardEntity.AccountingObjectId,
         "@JournalMemo", iNInwardOutwardEntity.JournalMemo,
         "@TotalAmount", iNInwardOutwardEntity.TotalAmount,
         "@TotalTaxAmount", iNInwardOutwardEntity.TotalTaxAmount,
         "@GeneratedRefID", iNInwardOutwardEntity.GeneratedRefId,
         "@RefOrder", iNInwardOutwardEntity.RefOrder,
         "@DocumentInclued", iNInwardOutwardEntity.DocumentInclued,
         "@CurrencyCode", iNInwardOutwardEntity.CurrencyCode,
         "@ExchangeRate", iNInwardOutwardEntity.ExchangeRate,
     });
 }
        public List <INInwardOutwardEntity> GetINInwardOutwards(string connectionString)
        {
            List <INInwardOutwardEntity> buentity = new List <INInwardOutwardEntity>();

            using (var context = new MISAEntity(connectionString))
            {
                var querry   = context.INInwardOutwardDetails.ToList();
                var querry2  = context.PUInvoiceDetails.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 stocks = context.Stocks.ToList();
                ////var topics = context.Topics.ToList();
                //var fixedassets = context.FixedAssets.ToList();
                var departments = context.Departments.ToList();
                //var purchasepurposes = context.PurchasePurposes.ToList();
                var inventoryitems       = context.InventoryItems.ToList();
                var suincrementdecrement = context.SUIncrementDecrements.ToList();
                banks = context.BankInfoes.ToList();
                var resultcontext = context.INInwardOutwards.ToList();
                //Get PuInvoice
                var resultcontext2                  = context.PUInvoices.Where(x => x.RefType == 301).ToList();
                var resultcontext2Detail            = context.PUInvoiceDetails.ToList();
                var resultcontext2Detailfixedassets = context.PUInvoiceDetailFixedAssets.ToList();
                //Get CAReceipts
                var resultcontext3       = context.CAReceipts.Where(x => x.RefType == 102).ToList();
                var resultcontext3sSales = context.CAReceiptDetailSales.ToList();
                //Get BADeposits
                var resultcontext4       = context.BADeposits.Where(x => x.RefType == 154).ToList();
                var resultcontext4sSales = context.BADepositDetailSales.ToList();
                //Get SAInvoices
                var resultcontext5           = context.SAInvoices.Where(x => x.RefType == 351).ToList();
                var resultcontext5Fixedasset = context.SAInvoiceDetails.ToList();
                //Get SAReturns
                var resultcontext6           = context.SAReturns.Where(x => x.RefType == 352).ToList();
                var resultcontext6Fixedasset = context.SAReturnDetails.ToList();
                foreach (var result in resultcontext)
                {
                    var newresult = new INInwardOutwardEntity();
                    newresult.RefId                = result.RefID.ToString();
                    newresult.RefType              = ConvRefType.ConvRefType(result.RefType);
                    newresult.RefDate              = result.RefDate;
                    newresult.PostedDate           = result.PostedDate;
                    newresult.RefNo                = result.RefNo;
                    newresult.ParalellRefNo        = result.ParalellRefNo;
                    newresult.AccountingObjectId   = result.AccountingObject == null ? null : result.AccountingObject.AccountingObjectID.ToString();
                    newresult.JournalMemo          = result.JournalMemo;
                    newresult.TotalAmount          = result.TotalAmount;
                    newresult.TotalTaxAmount       = result.TotalTaxAmount;
                    newresult.GeneratedRefId       = result.SUIncrementDecrement == null ? null : result.SUIncrementDecrement.RefID.ToString();
                    newresult.RefOrder             = result.RefOrder;
                    newresult.InwardOutwardDetails = result.INInwardOutwardDetails.Count <= 0 ? null : INInwardOutwardDetails(result.INInwardOutwardDetails.ToList(), result.RefID.ToString());
                    //newresult.DocumentInclued = result.Docume;
                    buentity.Add(newresult);
                }
                #region Lấy từ PuInvoice
                foreach (var result in resultcontext2)
                {
                    var newresult = new INInwardOutwardEntity();
                    newresult.RefId              = result.RefID.ToString();
                    newresult.RefType            = ConvRefType.ConvRefType(result.RefType);
                    newresult.RefDate            = result.RefDate;
                    newresult.PostedDate         = result.PostedDate;
                    newresult.RefNo              = result.RefNo;
                    newresult.ParalellRefNo      = result.ParalellRefNo;
                    newresult.AccountingObjectId = result.AccountingObject == null ? null : result.AccountingObject.AccountingObjectID.ToString();
                    newresult.JournalMemo        = result.JournalMemo;
                    newresult.TotalAmount        = result.TotalAmount;
                    newresult.TotalTaxAmount     = result.TotalTaxAmount;
                    //newresult.GeneratedRefId = result.SUIncrementDecrement == null ? null : result.SUIncrementDecrement.RefID.ToString();
                    newresult.RefOrder             = result.RefOrder;
                    newresult.InwardOutwardDetails = result.PUInvoiceDetails.Count <= 0 ? null : INInwardOutwardDetailsFromPUInvoiceDetails(result.PUInvoiceDetails.ToList(), result.RefID.ToString());
                    //newresult.DocumentInclued = result.Docume;
                    buentity.Add(newresult);
                }
                #endregion

                #region Lấy từ CAReceipts
                foreach (var result in resultcontext3)
                {
                    var newresult = new INInwardOutwardEntity();
                    newresult.RefId              = result.RefID.ToString();
                    newresult.RefType            = ConvRefType.ConvRefType(result.RefType);
                    newresult.RefDate            = result.RefDate;
                    newresult.PostedDate         = result.PostedDate;
                    newresult.RefNo              = result.RefNo;
                    newresult.ParalellRefNo      = result.ParalellRefNo;
                    newresult.AccountingObjectId = result.AccountingObject == null ? null : result.AccountingObject.AccountingObjectID.ToString();
                    newresult.JournalMemo        = result.JournalMemo;
                    newresult.TotalAmount        = result.TotalAmount;
                    newresult.TotalTaxAmount     = result.TotalTaxAmount;
                    //newresult.GeneratedRefId = result.SUIncrementDecrement == null ? null : result.SUIncrementDecrement.RefID.ToString();
                    newresult.RefOrder             = result.RefOrder;
                    newresult.InwardOutwardDetails = resultcontext3sSales.Count <= 0 ? null : INInwardOutwardDetailsFromCAReceipts(resultcontext3sSales.Where(x => x.RefID == result.RefID).ToList(), result.RefID.ToString());
                    // newresult.DocumentInclued = result.Docume;
                    buentity.Add(newresult);
                }
                #endregion

                #region Lấy từ BADeposit
                foreach (var result in resultcontext4)
                {
                    var newresult = new INInwardOutwardEntity();
                    newresult.RefId              = result.RefID.ToString();
                    newresult.RefType            = ConvRefType.ConvRefType(result.RefType);
                    newresult.RefDate            = result.RefDate;
                    newresult.PostedDate         = result.PostedDate;
                    newresult.RefNo              = result.RefNo;
                    newresult.ParalellRefNo      = result.ParalellRefNo;
                    newresult.AccountingObjectId = result.AccountingObject == null ? null : result.AccountingObject.AccountingObjectID.ToString();
                    newresult.JournalMemo        = result.JournalMemo;
                    newresult.TotalAmount        = result.TotalAmountOC;
                    newresult.TotalTaxAmount     = result.TotalTaxAmount;
                    //newresult.GeneratedRefId = result.SUIncrementDecrement == null ? null : result.SUIncrementDecrement.RefID.ToString();
                    newresult.RefOrder             = result.RefOrder;
                    newresult.InwardOutwardDetails = result.BADepositDetailSales.Count <= 0 ? null : INInwardOutwardDetailsFromBADeposits(result.BADepositDetailSales.ToList(), result.RefID.ToString());
                    // newresult.DocumentInclued = result.Docume;
                    buentity.Add(newresult);
                }
                #endregion

                #region Lấy từ SAInvoices
                foreach (var result in resultcontext5)
                {
                    var newresult = new INInwardOutwardEntity();
                    newresult.RefId              = result.RefID.ToString();
                    newresult.RefType            = ConvRefType.ConvRefType(result.RefType);
                    newresult.RefDate            = result.RefDate;
                    newresult.PostedDate         = result.PostedDate;
                    newresult.RefNo              = result.RefNo;
                    newresult.ParalellRefNo      = result.ParalellRefNo;
                    newresult.AccountingObjectId = result.AccountingObject == null ? null : result.AccountingObject.AccountingObjectID.ToString();
                    newresult.JournalMemo        = result.JournalMemo;
                    newresult.TotalAmount        = result.TotalAmount;
                    newresult.TotalTaxAmount     = result.TotalTaxAmount;
                    //newresult.GeneratedRefId = result.SUIncrementDecrement == null ? null : result.SUIncrementDecrement.RefID.ToString();
                    newresult.RefOrder             = result.RefOrder;
                    newresult.InwardOutwardDetails = result.SAInvoiceDetails.Count <= 0 ? null : INInwardOutwardDetailsFromSAInvoices(result.SAInvoiceDetails.ToList(), result.RefID.ToString());
                    // newresult.DocumentInclued = result.Docume;
                    buentity.Add(newresult);
                }
                #endregion

                #region Lấy từ SAReturns
                foreach (var result in resultcontext6)
                {
                    var newresult = new INInwardOutwardEntity();
                    newresult.RefId              = result.RefID.ToString();
                    newresult.RefType            = ConvRefType.ConvRefType(result.RefType);
                    newresult.RefDate            = result.RefDate;
                    newresult.PostedDate         = result.PostedDate;
                    newresult.RefNo              = result.RefNo;
                    newresult.ParalellRefNo      = result.ParalellRefNo;
                    newresult.AccountingObjectId = result.AccountingObject == null ? null : result.AccountingObject.AccountingObjectID.ToString();
                    newresult.JournalMemo        = result.JournalMemo;
                    newresult.TotalAmount        = result.TotalAmount;
                    newresult.TotalTaxAmount     = result.TotalTaxAmount;
                    //newresult.GeneratedRefId = result.SUIncrementDecrement == null ? null : result.SUIncrementDecrement.RefID.ToString();
                    newresult.RefOrder             = result.RefOrder;
                    newresult.InwardOutwardDetails = result.SAReturnDetails.Count <= 0 ? null : INInwardOutwardDetailsFromSAReturns(result.SAReturnDetails.ToList(), result.RefID.ToString());
                    // newresult.DocumentInclued = result.Docume;
                    buentity.Add(newresult);
                }
                #endregion
            }
            return(buentity.OrderBy(x => x.RefDate).ToList());
        }