示例#1
0
        public List<ABiPO> getPO(QueryCondition query)
        {
            List<ABiPO> result = new List<ABiPO>();

            try
            {
                var poList = dbContent.f_getPOReprot(query.CompanyCode,
                                                     query.CompanyName,
                                                     query.MeterialNumber,
                                                     query.VendorCode,
                                                     query.PONumber,
                                                     query.GetMinDate(query.DateBegin),
                                                     query.GetMaxDate(query.DateEnd),
                                                     query.UserID);
                result = (from obj in poList
                         select new ABiPO()
                         {
                             CompanyCode = obj.CompanyCode,
                             Amount = obj.Amount ?? 0,
                             Currency = obj.Currency,
                             MeterialName = obj.MeterialName,
                             MeterialNumber = obj.MeterialNumber,
                             NetPrice = obj.NetPrice ?? 0,
                             PriceUnit = obj.PirceUnit,
                             PlantCode = obj.PlantCode,
                             POCreateDate = obj.POCreateDate ?? DateTime.MinValue,
                             POCreator = obj.POCreator,
                             PODeliverDate = obj.DeliveryDate ?? DateTime.MinValue,
                             PONumber = obj.PONumber,
                             POItemNumber = obj.POItemNumber,
                             Quantity = obj.Quantity ?? 0,
                             QuantityUnit = obj.QuantityUnit,
                             TaxCode = obj.TaxCode,
                             VendorCode = obj.VendorCode,
                             VendorName = obj.VendorName,
                             POStatus = obj.POStatus,
                             IsReturn = (obj.IsReturn == 1 ? true : false),
                             RoleID = query.RoleID
                         }).ToList();
            }
            catch (Exception ex)
            {
                logger.LogError(query, ex);
            }
            return result;
        }
示例#2
0
        public List<ABiIVPending> getIVPending(QueryCondition query)
        {
            try
            {
                var objList = dbContent.f_getInvoicePending(query.VendorCode,
                                                            query.VendcorName,
                                                           query.CompanyCode,
                                                           query.InvoiceNumber,
                                                           query.GetMinDate(query.DateBegin),
                                                           query.GetMaxDate(query.DateEnd),
                                                           query.Buys,
                                                           query.UserID);

                return (from obj in objList
                        select new ABiIVPending()
                        {
                            InvoiceNumber = obj.InvoiceNumber,
                            CompanyCode = obj.CompanyCode,
                            VendorCode = obj.VendorCode,
                            TotalAmount = obj.TotalAmount ?? 0,
                            TaxAmount = obj.TaxAmount ?? 0,
                            InvoiceDate = obj.InvoiceDate ?? DateTime.MinValue,
                            Remark = obj.Remark,
                            InvoiceID = obj.ABi_Invoice_ID,
                            POCreator = obj.POCreator
                        }).ToList();
            }
            catch (Exception ex)
            {
                logger.LogError(query, ex);
            }
            return new List<ABiIVPending>();
        }
示例#3
0
        public List<ABiIVCompleted> getIVCompleted(QueryCondition query)
        {
            try
            {
                bool? isTolerance = null;
                switch (query.IsTolerance)
                {
                    case "0":
                        isTolerance = false;
                        break;
                    case "1":
                        isTolerance = true;
                        break;
                }

                var objList = dbContent.f_getInvoiceCompleted(query.VendorCode,
                                                           query.CompanyCode,
                                                           query.InvoiceNumber,
                                                           isTolerance,
                                                           query.GetMinDate(query.DateBegin),
                                                           query.GetMaxDate(query.DateEnd),
                                                           query.UserID);

                return (from obj in objList
                        select new ABiIVCompleted()
                        {
                            InvoiceNumber = obj.InvoiceNumber,
                            CompanyCode = obj.CompanyCode,
                            VendorCode = obj.VendorCode,
                            TotalAmount = obj.TotalAmount ?? 0,
                            TaxAmount = obj.TaxAmount ?? 0,
                            InvoiceDate = obj.InvoiceDate ?? DateTime.MinValue,
                            IVNumber = obj.IVNumber,
                            IVPostDate = obj.IVPostDate ?? DateTime.MinValue,
                            Status = obj.InvoiceStatus,
                            IsTolerance = obj.IsTolerance ?? false,
                            InvoiceID = obj.InvoiceID
                        }).ToList();
            }
            catch (Exception ex)
            {
                logger.LogError(query, ex);
            }
            return new List<ABiIVCompleted>();
        }
示例#4
0
        public List<ABiIV> getIV(QueryCondition query)
        {
            try
            {

                var objList = dbContent.f_getInvoiceStatus(query.VendorCode,
                                                           query.CompanyCode,
                                                           query.InvoiceNumber,
                                                           query.GetMinDate(query.DateBegin),
                                                           query.GetMaxDate(query.DateEnd),
                                                           query.PaymentStatus,
                                                           query.UserID);

                return (from obj in objList
                        select new ABiIV()
                        {
                            CompanyCode = obj.CompanyCode,
                            VendorCode = obj.VendorCode,
                            InvoiceNumber = obj.InvoiceNumber,
                            InvoiceDate = obj.InvoiceDate ?? DateTime.MinValue,
                            PaymentStatus = obj.PaymentStatus,
                            DueDate = obj.DueDate ?? DateTime.MinValue,
                            PaymentDate = obj.DatePayment ?? DateTime.MinValue,
                            PayAmount = obj.PayAmount ?? 0,
                            RoleID = query.RoleID,
                            InvoiceID = obj.ABi_Invoice_ID,
                            IsSynced = obj.IsSynced ?? false
                        }).ToList();
            }
            catch (Exception ex)
            {
                logger.LogError(query, ex);
            }
            return new List<ABiIV>();
        }
示例#5
0
        public List<ABiNewIV> getNewIV(QueryCondition query)
        {
            try
            {
                if (query.UserID == 0) return new List<ABiNewIV>();

                var objList = dbContent.f_getGRNewIV(query.UserID,
                                                     query.CompanyCode,
                                                     query.GRNumber,
                                                     query.PONumber,
                                                     query.GetMinDate(query.PODateStart),
                                                     query.GetMaxDate(query.PODateEnd),
                                                     query.GetMinDate(query.DateStart),
                                                     query.GetMaxDate(query.DateEnd),
                                                     query.VendorCode);

                var orgObjs = (from obj in objList
                        where obj.PendingIVPrice > 0.001 || obj.PendingIVPrice < -0.001
                        select new ABiNewIV() {
                            CompanyName = obj.CompanyName,
                            PONumber = obj.PONumber,
                            POItemNumber = obj.POItemNumber,
                            MeterialName = obj.MeterialName,
                            PendingIVGRQuantity = obj.PendingIVQuantity ?? 0,
                            QuantityUnit = obj.QuantityUnit,
                            PONetPrice = obj.NetPrice ?? 0,
                            PriceUnit = obj.PirceUnit,
                            PendingIVPrice = obj.PendingIVPrice ?? 0,
                            GRDate = obj.GRDate ?? DateTime.MinValue,
                            MeterialNumber = obj.MeterialNumber,
                            POQuantity = obj.Quantity ?? 0,
                            POTotalPrice = obj.Amount ?? 0,
                            POCreator = obj.POCreator,
                            POCreateDate = obj.POCreateDate ?? DateTime.MinValue,
                            GRDeliveryDate = obj.DeliveryDate ?? DateTime.MinValue,
                            PaymentTerm = obj.PaymentTerm,
                            CompanyCode = obj.CompanyCode,
                            PlantCode = obj.PlantCode,
                            VendorCode = obj.VendorCode,
                            RefGRNumber = obj.RefGRNumber,
                            RefGRItemNubmer = obj.RefGRItemNumber,
                            IsExport = query.IsExport,
                            IsReturn = obj.IsRetrun.ToString(),
                            RefGRNumber1xx = "",
                            RefGRItemNumber1xx = "",
                            RoleID = query.RoleID
                        }).ToList();

                return orgObjs;
                //String poNumber = "";
                //String poItemNumber = "";
                //double retPrice = 0.0;
                //double retQty = 0.0;
                //String retRefNums = "";
                //String retRefINs = "";

                //List<String> unmatchedRefGN = new List<string>();
                //List<String> unmatchedRefGI = new List<string>();
                //foreach (var gr in orgObjs)
                //{
                //    if (gr.IsReturn != "1" && gr.PendingIVGRQuantity < 0)
                //    {
                //        if (!String.IsNullOrEmpty(poNumber) && (poNumber != gr.PONumber || poItemNumber != gr.POItemNumber))
                //        {
                //            unmatchedRefGN.AddRange(retRefNums.Split('-'));
                //            unmatchedRefGI.AddRange(retRefINs.Split('-'));

                //            retRefNums = "";
                //            retRefINs = "";
                //            retPrice = 0.0;
                //            retQty = 0.0;
                //        }
                //        poNumber = gr.PONumber;
                //        poItemNumber = gr.POItemNumber;
                //        retPrice += gr.PendingIVPrice;
                //        retQty += gr.PendingIVGRQuantity;
                //        if (!String.IsNullOrEmpty(retRefNums))
                //        {
                //            retRefNums += "-" + gr.RefGRNumber;
                //            retRefINs += "-" + gr.RefGRItemNubmer;
                //        }
                //        else
                //        {
                //            retRefNums = gr.RefGRNumber;
                //            retRefINs = gr.RefGRItemNubmer;
                //        }
                //    }
                //    else if (gr.IsReturn != "1" && gr.PendingIVGRQuantity > 0)
                //    {
                //        if (!String.IsNullOrEmpty(poNumber) &&
                //            gr.PONumber == poNumber &&
                //            gr.POItemNumber == poItemNumber)
                //        {
                //            gr.PendingIVGRQuantity += retQty;
                //            gr.PendingIVPrice += retPrice;
                //            if (!String.IsNullOrEmpty(gr.RefGRNumber1xx))
                //            {
                //                gr.RefGRNumber1xx += "-";
                //                gr.RefGRItemNumber1xx += "-";
                //            }
                //            gr.RefGRNumber1xx += retRefNums;
                //            gr.RefGRItemNumber1xx += retRefINs;
                //        }
                //        else if (!String.IsNullOrEmpty(retRefNums) && !String.IsNullOrEmpty(retRefINs))
                //        {
                //            unmatchedRefGN.AddRange(retRefNums.Split('-'));
                //            unmatchedRefGI.AddRange(retRefINs.Split('-'));
                //        }
                //        poNumber = "";
                //        poItemNumber = "";
                //        retPrice = 0.0;
                //        retQty = 0.0;

                //        retRefNums = "";
                //        retRefINs = "";
                //    }
                //}

                //return (from o in orgObjs
                //        where o.IsReturn == "1" ||
                //        (o.PendingIVGRQuantity > 0 || o.PendingIVPrice > 0) ||
                //        (o.PendingIVGRQuantity < 0 && o.PendingIVPrice < 0 && !String.IsNullOrEmpty(o.RefGRItemNumber1xx)) ||
                //        (unmatchedRefGN.Contains(o.RefGRNumber) && unmatchedRefGI.Contains(o.RefGRItemNubmer))
                //        select o).ToList();
            }
            catch (Exception ex)
            {
                logger.LogError(String.Format("f_getGRNewIV({0}, {1}, {2}, {3})",
                                                query.UserID,
                                                query.CompanyCode,
                                                query.GRNumber,
                                                query.PONumber),
                                ex);
            }
            return new List<ABiNewIV>();
        }
示例#6
0
        /// <summary>
        /// 发票与收货对应报表
        /// </summary>
        /// <param name="query"></param>
        /// <returns></returns>
        public List<ABiGRIV> GetGRIV(QueryCondition query)
        {
            try
            {
                var objList = dbContent.f_getGRInvoiceReport(query.IVNumber,
                                                             query.VendorCode,
                                                             query.GetMinDate(query.DateStart),
                                                             query.GetMaxDate(query.DateEnd),
                                                             query.PONumber,
                                                             query.UserID);

                return (from obj in objList
                        select new ABiGRIV() {
                            IVNumber = obj.InvoiceNumber,
                            IVDate = obj.InvoiceDate ?? DateTime.MinValue,
                            PONumber = obj.PONumber,
                            POItemNumber = obj.POItemNumber,
                            GRNumber = obj.RefGRNumber,
                            GRItemNumber = obj.RefGRItemNumber,
                            GRDate = obj.GRDate ?? DateTime.MinValue,
                            VendorCode = obj.VendorCode,
                            VendorName = obj.VendorName,
                            MeterialNumber = obj.MeterialNumber,
                            MeterialName = obj.MeterialName
                        }).ToList();
            }
            catch (Exception ex)
            {
                logger.LogError(query, ex);
            }
            return new List<ABiGRIV>();
        }
示例#7
0
        /// <summary>
        /// 收货报表
        /// </summary>
        /// <param name="query"></param>
        /// <returns></returns>
        public List<ABiGR> GetGR(QueryCondition query)
        {
            try
            {
                var objList = dbContent.f_getGRReport(query.PONumber,
                                                      query.GRNumber,
                                                      query.VendorCode,
                                                      query.MoveType,
                                                      query.GetMinDate(query.DateStart),
                                                      query.GetMaxDate(query.DateEnd),
                                                      query.UserID);

                return (from obj in objList
                        select new ABiGR() {
                            PONumber = obj.PONumber,
                            POItemNumber = obj.POItemNumber,
                            GRNumber = obj.GRNumber,
                            GRItemNumber = obj.GRItemNumber,
                            MoveType = obj.MoveType,
                            GRDate = obj.GRDate ?? DateTime.MinValue,
                            GRQuantity = obj.Quantity ?? 0,
                            GRAmount = obj.GRAmount ?? 0,
                            Currency = obj.Currency,
                            PlantCode = obj.PlantCode,
                            RoleID = query.RoleID
                        }).ToList();
            }
            catch (Exception ex)
            {
                logger.LogError(query, ex);
            }

            return new List<ABiGR>();
        }
示例#8
0
 public List<ABiPOIV> getPOIV(QueryCondition query)
 {
     try
     {
         var result = dbContent.f_getPOInvoiceReport(query.CompanyCode,
                                                     query.CompanyName,
                                                     query.MeterialNumber,
                                                     query.VendorCode,
                                                     query.PONumber,
                                                     query.GetMinDate(query.DateBegin),
                                                     query.GetMaxDate(query.DateEnd),
                                                     query.UserID);
         return (from obj in result
                 select new ABiPOIV()
                 {
                     CompanyCode = obj.CompanyCode,
                     PlantCode = obj.PlantCode,
                     VendorCode = obj.VendorCode,
                     VendorName = obj.VendorName,
                     PONumber = obj.PONumber,
                     POItemNumber = obj.POItemNumber,
                     GRNumber = obj.GRNumber,
                     GRItemNumber = obj.GRItemNumber,
                     MeterialNumber = obj.MeterialNumber,
                     MeterialName = obj.MeterialName,
                     Quantity = obj.Quantity ?? 0,
                     QuantityUnit = obj.QuantityUnit,
                     TaxRate = obj.TaxCode,
                     NetPrice = obj.NetPrice ?? 0,
                     PriceUnit = obj.PirceUnit,
                     Amount = obj.Amount ?? 0,
                     Currency = obj.Currency,
                     POCreateDate = obj.POCreateDate ?? DateTime.MinValue,
                     DeliveryDate = obj.DeliveryDate ?? DateTime.MinValue,
                     POCreator = obj.POCreator,
                     IVNumber = obj.IVNumber,
                     IVPostDate = obj.IVPostDate ?? DateTime.MinValue,
                     InvoiceNumber = obj.InvoiceNumber,
                     InvoiceDate = obj.InvoiceDate ?? DateTime.MinValue
                 }).ToList();
     }
     catch (Exception ex)
     {
         logger.LogError(query, ex);
     }
     return new List<ABiPOIV>();
 }
示例#9
0
        public List<ABiPOStatus> getPOStatus(QueryCondition query)
        {
            try
            {
                var objList = dbContent.f_getPOStatusReport(query.CompanyCode,
                                                            query.CompanyName,
                                                            query.MeterialNumber,
                                                            query.VendorCode,
                                                            query.PONumber,
                                                            query.GetMinDate(query.DateBegin),
                                                            query.GetMaxDate(query.DateEnd),
                                                            query.UserID);

                var result = new Dictionary<String, ABiPOStatus>();
                foreach (var obj in objList)
                {
                    ABiPOStatus po = null;
                    if (result.ContainsKey(obj.PONumber + obj.POItemNumber))
                    {
                        po = result[obj.PONumber + obj.POItemNumber];
                        po.GRAmountList.Add(obj.GRAmount ?? 0);
                        po.GRDateList.Add(obj.GRDate ?? DateTime.MinValue);
                        po.GRQuantityList.Add(obj.GRQuantity ?? 0);
                        po.GRAmountPending -= obj.GRAmount ?? 0;
                        po.GRQuantityPending -= obj.GRQuantity ?? 0;
                        if (po.GRAmountPending < 0) po.GRAmountPending = 0;
                        if (po.GRQuantityPending < 0) po.GRQuantityPending = 0;
                        if (po.GRQuantityPending == 0) po.GRAmountPending = 0;
                    }
                    else
                    {
                        po = new ABiPOStatus();
                        po.CompanyCode = obj.CompanyCode;
                        po.VendorCode = obj.VendorCode;
                        po.VendorName = obj.VendorName;
                        po.PONumber = obj.PONumber;
                        po.POItemNumber = obj.POItemNumber;
                        po.MeterialNumber = obj.MeterialNumber;
                        po.MeterialName = obj.MeterialName;
                        po.Quantity = obj.Quantity ?? 0;
                        po.QuantityUnit = obj.QuantityUnit;
                        po.TaxRate = obj.TaxCode;
                        po.NetPrice = obj.NetPrice ?? 0;
                        po.PriceUnit = obj.PirceUnit;
                        po.Amount = obj.Amount ?? 0;
                        po.Currency = obj.Currency;
                        po.POCreateDate = obj.POCreateDate ?? DateTime.MinValue;
                        po.DeliveryDate = obj.DeliveryDate ?? DateTime.MinValue;
                        po.POCreator = obj.POCreator;
                        po.GRDateList = new List<DateTime>();
                        po.GRDateList.Add(obj.GRDate ?? DateTime.MinValue);
                        po.GRQuantityList = new List<double>();
                        po.GRQuantityList.Add(obj.GRQuantity ?? 0);
                        po.GRAmountList = new List<double>();
                        po.GRAmountList.Add(obj.GRAmount ?? 0);
                        po.GRQuantityPending = po.Quantity - po.GRQuantityList[0];
                        po.GRAmountPending = po.Amount - po.GRAmountList[0];
                        result.Add(obj.PONumber + obj.POItemNumber, po);
                        po.POStatus = obj.POStatus;
                        po.IsReturn = (obj.IsReturn == 1);
                    }
                }
                return result.Values.ToList();
            }
            catch (Exception ex)
            {
                logger.LogError(query, ex);
            }

            return new List<ABiPOStatus>();
        }
示例#10
0
        public List<ABiNewIV> getNewIV(QueryCondition query)
        {
            try
            {
                if (query.UserID == 0) return new List<ABiNewIV>();

                var objList = dbContent.f_getGRNewIV(query.UserID,
                                                     query.CompanyCode,
                                                     query.GRNumber,
                                                     query.PONumber,
                                                     query.GetMinDate(query.PODateStart),
                                                     query.GetMaxDate(query.PODateEnd),
                                                     query.GetMinDate(query.DateStart),
                                                     query.GetMaxDate(query.DateEnd),
                                                     query.VendorCode);

                var orgObjs = (from obj in objList
                        where obj.PendingIVPrice > 0.001 || obj.PendingIVPrice < -0.001
                        select new ABiNewIV() {
                            CompanyName = obj.CompanyName,
                            PONumber = obj.PONumber,
                            POItemNumber = obj.POItemNumber,
                            MeterialName = obj.MeterialName,
                            PendingIVGRQuantity = obj.PendingIVQuantity ?? 0,
                            QuantityUnit = obj.QuantityUnit,
                            PONetPrice = obj.NetPrice ?? 0,
                            PriceUnit = obj.PirceUnit,
                            PendingIVPrice = obj.PendingIVPrice ?? 0,
                            GRDate = obj.GRDate ?? DateTime.MinValue,
                            MeterialNumber = obj.MeterialNumber,
                            POQuantity = obj.Quantity ?? 0,
                            POTotalPrice = obj.Amount ?? 0,
                            POCreator = obj.POCreator,
                            POCreateDate = obj.POCreateDate ?? DateTime.MinValue,
                            GRDeliveryDate = obj.DeliveryDate ?? DateTime.MinValue,
                            PaymentTerm = obj.PaymentTerm,
                            CompanyCode = obj.CompanyCode,
                            PlantCode = obj.PlantCode,
                            VendorCode = obj.VendorCode,
                            RefGRNumber = obj.RefGRNumber,
                            RefGRItemNubmer = obj.RefGRItemNumber,
                            IsExport = query.IsExport,
                            IsReturn = obj.IsRetrun.ToString(),
                            RefGRNumber1xx = "",
                            RefGRItemNumber1xx = "",
                            RoleID = query.RoleID
                        }).ToList();

                return orgObjs;
            }
            catch (Exception ex)
            {
                logger.LogError(String.Format("f_getGRNewIV({0}, {1}, {2}, {3})",
                                                query.UserID,
                                                query.CompanyCode,
                                                query.GRNumber,
                                                query.PONumber),
                                ex);
            }
            return new List<ABiNewIV>();
        }