Exemplo n.º 1
0
 /// <summary>
 /// Отгрузка товара по накладной
 /// </summary>
 /// <param name="objProfile">Профайл</param>
 /// <param name="IntWaybill_Guid">УИ накладной на отгрузку</param>
 /// <param name="IntWaybill_ShipDate">Дата отгрузки</param>
 /// <param name="SetIntWaybillShipMode_Guid">УИ варианта отгрузки</param>
 /// <param name="IntWaybillState_Guid">УИ текущего состояния накладной</param>
 /// <param name="iErr">целочисленный код ошибки</param>
 /// <param name="strErr">текст ошибки</param>
 /// <returns>0 - накладная отгружена; <>0 - ошибка</returns>
 public static System.Int32 ShippedProductsByIntWaybill(UniXP.Common.CProfile objProfile,
                                                        System.Guid IntWaybill_Guid, System.DateTime IntWaybill_ShipDate, System.Guid SetIntWaybillShipMode_Guid,
                                                        ref System.Guid IntWaybillState_Guid, ref System.Int32 iErr, ref System.String strErr)
 {
     System.Int32 iRet = -1;
     try
     {
         iRet = CIntWaybillDataBaseModel.ShippedProductsByIntWaybill(objProfile, null,
                                                                     IntWaybill_Guid, IntWaybill_ShipDate, SetIntWaybillShipMode_Guid,
                                                                     ref IntWaybillState_Guid, ref iErr, ref strErr);
     }
     catch (System.Exception f)
     {
         strErr += ("\n" + f.Message);
     }
     finally
     {
     }
     return(iRet);
 }
Exemplo n.º 2
0
        /// <summary>
        /// Возвращает список накладных за указанный период
        /// </summary>
        /// <param name="objProfile">профайл</param>
        /// <param name="IntWaybill_Guid">УИ документа</param>
        /// <param name="IntWaybill_DateBegin">начало периода для выборки</param>
        /// <param name="IntWaybill_DateEnd">конец периода для выборки</param>
        /// <param name="IntWaybill_SrcCompanyGuid">УИ компании "Откуда"</param>
        /// <param name="IntWaybill_SrcStockGuid">УИ склада "Откуда"<</param>
        /// <param name="IntWaybill_DstCompanyGuid">УИ компании "Куда"</param>
        /// <param name="IntWaybill_DstStockGuid">УИ склада "Куда"<</param>
        /// <param name="Waybill_PaymentTypeGuid">УИ формы оплаты</param>
        /// <param name="strErr">текст ошибки</param>
        /// <param name="SelectIntWaybillInfoFromIntOrder">признак "информация для накладной запрашивается из заказа"</param>
        /// <param name="OnlyUnShippedWaybills">признак "запрос только НЕ отгруженных накладных"</param>
        /// <returns>список объектов класса "CIntWaybill"</returns>
        public static List <CIntWaybill> GetWaybillList(UniXP.Common.CProfile objProfile,
                                                        System.Guid IntWaybill_Guid,
                                                        System.DateTime IntWaybill_DateBegin, System.DateTime IntWaybill_DateEnd,
                                                        System.Guid IntWaybill_SrcCompanyGuid, System.Guid IntWaybill_SrcStockGuid,
                                                        System.Guid IntWaybill_DstCompanyGuid, System.Guid IntWaybill_DstStockGuid,
                                                        System.Guid Waybill_PaymentTypeGuid, ref System.String strErr,
                                                        System.Boolean SelectIntWaybillInfoFromIntOrder = false,
                                                        System.Boolean OnlyUnShippedWaybills            = false
                                                        )
        {
            List <CIntWaybill> objList = new List <CIntWaybill>();

            try
            {
                // вызов статического метода из класса, связанного с БД
                System.Data.DataTable dtList = CIntWaybillDataBaseModel.GetWaybillTable(objProfile, null, IntWaybill_Guid,
                                                                                        IntWaybill_DateBegin, IntWaybill_DateEnd, IntWaybill_SrcCompanyGuid, IntWaybill_SrcStockGuid,
                                                                                        IntWaybill_DstCompanyGuid, IntWaybill_DstStockGuid,
                                                                                        Waybill_PaymentTypeGuid, ref strErr,
                                                                                        SelectIntWaybillInfoFromIntOrder, OnlyUnShippedWaybills);
                if (dtList != null)
                {
                    CIntWaybill  objWaybill       = null;
                    System.Int32 objWaybill_Ib_ID = 0;
                    foreach (System.Data.DataRow objItem in dtList.Rows)
                    {
                        objWaybill            = new CIntWaybill();
                        objWaybill_Ib_ID      = System.Convert.ToInt32(objItem["IntWaybill_Id"]);
                        objWaybill.ID         = ((objItem["IntWaybill_Guid"] != System.DBNull.Value) ? new System.Guid(System.Convert.ToString(objItem["IntWaybill_Guid"])) : System.Guid.Empty);
                        objWaybill.ParentID   = ((objItem["IntWaybillParent_Guid"] != System.DBNull.Value) ? new System.Guid(System.Convert.ToString(objItem["IntWaybillParent_Guid"])) : System.Guid.Empty);
                        objWaybill.IntOrderID = ((objItem["IntOrder_Guid"] != System.DBNull.Value) ? new System.Guid(System.Convert.ToString(objItem["IntOrder_Guid"])) : System.Guid.Empty);
                        objWaybill.StockSrc   = ((objItem["SrcStock_Guid"] != System.DBNull.Value) ? new CStock()
                        {
                            ID = (System.Guid)objItem["SrcStock_Guid"],
                            IBId = System.Convert.ToInt32(objItem["SrcStock_Id"]),
                            Name = System.Convert.ToString(objItem["SrcStock_Name"]),
                            IsAcitve = System.Convert.ToBoolean(objItem["SrcStock_IsActive"]),
                            IsTrade = System.Convert.ToBoolean(objItem["SrcStock_IsTrade"]),
                            WareHouse = new CWarehouse()
                            {
                                ID = (System.Guid)objItem["SrcWarehouse_Guid"]
                            },
                            WareHouseType = new CWareHouseType()
                            {
                                ID = (System.Guid)objItem["SrcWarehouseType_Guid"]
                            }
                        } : null);
                        objWaybill.CompanySrc = ((objItem["SrcCompany_Guid"] != System.DBNull.Value) ? new CCompany()
                        {
                            ID = (System.Guid)objItem["SrcCompany_Guid"],
                            InterBaseID = System.Convert.ToInt32(objItem["SrcCompany_Id"]),
                            Abbr = System.Convert.ToString(objItem["SrcCompany_Acronym"]),
                            Name = System.Convert.ToString(objItem["SrcCompany_Name"])
                        } : null);
                        objWaybill.StockDst = ((objItem["DstStock_Guid"] != System.DBNull.Value) ? new CStock()
                        {
                            ID = (System.Guid)objItem["DstStock_Guid"],
                            IBId = System.Convert.ToInt32(objItem["DstStock_Id"]),
                            Name = System.Convert.ToString(objItem["DstStock_Name"]),
                            IsAcitve = System.Convert.ToBoolean(objItem["DstStock_IsActive"]),
                            IsTrade = System.Convert.ToBoolean(objItem["DstStock_IsTrade"]),
                            WareHouse = new CWarehouse()
                            {
                                ID = (System.Guid)objItem["DstWarehouse_Guid"]
                            },
                            WareHouseType = new CWareHouseType()
                            {
                                ID = (System.Guid)objItem["DstWarehouseType_Guid"]
                            }
                        } : null);
                        objWaybill.CompanyDst = ((objItem["DstCompany_Guid"] != System.DBNull.Value) ? new CCompany()
                        {
                            ID = (System.Guid)objItem["DstCompany_Guid"],
                            InterBaseID = System.Convert.ToInt32(objItem["DstCompany_Id"]),
                            Abbr = System.Convert.ToString(objItem["DstCompany_Acronym"]),
                            Name = System.Convert.ToString(objItem["DstCompany_Name"])
                        } : null);

                        objWaybill.Currency = ((objItem["Currency_Guid"] != System.DBNull.Value) ? new CCurrency()
                        {
                            ID = (System.Guid)objItem["Currency_Guid"],
                            CurrencyAbbr = System.Convert.ToString(objItem["Currency_Abbr"])
                        } : null);

                        objWaybill.Depart = ((objItem["Depart_Guid"] != System.DBNull.Value) ? new CDepart()
                        {
                            uuidID = (System.Guid)objItem["Depart_Guid"],
                            DepartCode = System.Convert.ToString(objItem["Depart_Code"])
                        } : null);


                        objWaybill.PaymentType = ((objItem["PaymentType_Guid"] != System.DBNull.Value) ? new CPaymentType(
                                                      (System.Guid)objItem["PaymentType_Guid"], System.Convert.ToString(objItem["PaymentType_Name"])) : null);

                        objWaybill.BeginDate = ((objItem["IntWaybill_BeginDate"] != System.DBNull.Value) ? System.Convert.ToDateTime(objItem["IntWaybill_BeginDate"]) : System.DateTime.MinValue);
                        if (objItem["IntWaybill_ShipDate"] != System.DBNull.Value)
                        {
                            objWaybill.ShipDate = System.Convert.ToDateTime(objItem["IntWaybill_ShipDate"]);
                        }
                        objWaybill.DocNum       = ((objItem["IntWaybill_Num"] != System.DBNull.Value) ? System.Convert.ToString(objItem["IntWaybill_Num"]) : System.String.Empty);
                        objWaybill.RetailDocNum = ((objItem["RetailWaybill_Num"] != System.DBNull.Value) ? System.Convert.ToString(objItem["RetailWaybill_Num"]) : System.String.Empty);

                        objWaybill.DocState = ((objItem["IntWaybillState_Guid"] != System.DBNull.Value) ? new CIntWaybillState()
                        {
                            ID = (System.Guid)objItem["IntWaybillState_Guid"],
                            IntWaybillStateId = System.Convert.ToInt32(objItem["IntWaybillState_Id"]),
                            Name = System.Convert.ToString(objItem["IntWaybillState_Name"])
                        } : null);

                        objWaybill.WaybillShipMode = ((objItem["IntWaybillShipMode_Guid"] != System.DBNull.Value) ? new CIntWaybillShipMode()
                        {
                            ID = (System.Guid)objItem["IntWaybillShipMode_Guid"],
                            WaybillShipModeId = System.Convert.ToInt32(objItem["IntWaybillShipMode_Id"]),
                            Name = System.Convert.ToString(objItem["IntWaybillShipMode_Name"])
                        } : null);

                        objWaybill.Description = ((objItem["IntWaybill_Description"] != System.DBNull.Value) ? System.Convert.ToString(objItem["IntWaybill_Description"]) : System.String.Empty);
                        objWaybill.IsForStock  = ((objItem["IntWaybill_ForStock"] != System.DBNull.Value) ? System.Convert.ToBoolean(objItem["IntWaybill_ForStock"]) : false);
                        objWaybill.IsSend      = ((objItem["IntWaybill_Send"] != System.DBNull.Value) ? System.Convert.ToBoolean(objItem["IntWaybill_Send"]) : false);

                        objWaybill.SumWaybill  = ((objItem["IntWaybill_AllPrice"] != System.DBNull.Value) ? System.Convert.ToDouble(objItem["IntWaybill_AllPrice"]) : 0);
                        objWaybill.SumDiscount = 0; // ((objItem["IntWaybill_AllDiscount"] != System.DBNull.Value) ? System.Convert.ToDouble(objItem["IntWaybill_AllDiscount"]) : 0);
                        objWaybill.SumRetail   = ((objItem["IntWaybill_RetailAllPrice"] != System.DBNull.Value) ? System.Convert.ToDouble(objItem["IntWaybill_RetailAllPrice"]) : 0);

                        objWaybill.Quantity = ((objItem["IntWaybill_Quantity"] != System.DBNull.Value) ? System.Convert.ToDouble(objItem["IntWaybill_Quantity"]) : 0);

                        if (objWaybill != null)
                        {
                            objList.Add(objWaybill);
                        }
                    }
                }

                dtList = null;
            }
            catch (System.Exception f)
            {
                strErr += (String.Format("\nНе удалось получить список накладных.\nТекст ошибки: {0}", f.Message));
            }
            return(objList);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Возвращает приложение к накладной на внутреннее перемещение
        /// </summary>
        /// <param name="objProfile">профайл</param>
        /// <param name="uuidIntWaybillId">уи накладной на внутреннее перемещение</param>
        /// <param name="strErr">сообщение об ошибке</param>
        /// <param name="bTableFromIntOrder">признак "приложение запрашивается из заказа на внутреннее перемещение"</param>
        /// <returns>приложение к накладной, как список объектов класса CWaybillItem</returns>
        public static List <CIntWaybillItem> GetIntWaybillTablePart(UniXP.Common.CProfile objProfile,
                                                                    System.Guid uuidIntWaybillId, ref System.String strErr, System.Boolean bTableFromIntOrder = false)
        {
            List <CIntWaybillItem> objList = new List <CIntWaybillItem>();

            try
            {
                System.Data.DataTable dtList = CIntWaybillDataBaseModel.GetIntWaybilItemTable(objProfile, null, uuidIntWaybillId, ref strErr, bTableFromIntOrder);
                if (dtList != null)
                {
                    CIntWaybillItem objWaybillItem = null;
                    foreach (System.Data.DataRow objItem in dtList.Rows)
                    {
                        objWaybillItem = new CIntWaybillItem();

                        objWaybillItem.ID             = ((objItem["WaybItem_Guid"] != System.DBNull.Value) ? (System.Guid)objItem["WaybItem_Guid"] : System.Guid.Empty);
                        objWaybillItem.Ib_ID          = ((objItem["WaybItem_Id"] != System.DBNull.Value) ? System.Convert.ToInt32(objItem["WaybItem_Id"]) : 0);
                        objWaybillItem.IntOrderItemID = ((objItem["SupplItem_Guid"] != System.DBNull.Value) ? (System.Guid)objItem["SupplItem_Guid"] : System.Guid.Empty);
                        objWaybillItem.Product        = ((objItem["Parts_Guid"] != System.DBNull.Value) ? new CProduct()
                        {
                            ID = (System.Guid)objItem["Parts_Guid"],
                            Name = System.Convert.ToString(objItem["PARTS_NAME"]),
                            Article = System.Convert.ToString(objItem["PARTS_ARTICLE"]),
                            ProductTradeMark = new CProductTradeMark()
                            {
                                Name = System.Convert.ToString(objItem["ProductOwnerName"])
                            }
                        } : null);

                        objWaybillItem.Measure = ((objItem["Measure_Guid"] != System.DBNull.Value) ? new CMeasure()
                        {
                            ID = (System.Guid)objItem["Measure_Guid"],
                            ShortName = System.Convert.ToString(objItem["Measure_ShortName"])
                        } : null);

                        objWaybillItem.Quantity       = ((objItem["WaybItem_Quantity"] != System.DBNull.Value) ? System.Convert.ToDouble(objItem["WaybItem_Quantity"]) : 0);
                        objWaybillItem.QuantityReturn = ((objItem["WaybItem_RetQuantity"] != System.DBNull.Value) ? System.Convert.ToDouble(objItem["WaybItem_RetQuantity"]) : 0);

                        objWaybillItem.NDSPercent                            = ((objItem["WaybItem_NDSPercent"] != System.DBNull.Value) ? System.Convert.ToDouble(objItem["WaybItem_NDSPercent"]) : 0);
                        objWaybillItem.MarkUpPercent                         = ((objItem["WaybItem_MarkUpPercent"] != System.DBNull.Value) ? System.Convert.ToDouble(objItem["WaybItem_MarkUpPercent"]) : 0);
                        objWaybillItem.PriceImporter                         = ((objItem["WaybItem_PriceImporter"] != System.DBNull.Value) ? System.Convert.ToDouble(objItem["WaybItem_PriceImporter"]) : 0);
                        objWaybillItem.Price                                 = ((objItem["WaybItem_Price"] != System.DBNull.Value) ? System.Convert.ToDouble(objItem["WaybItem_Price"]) : 0);
                        objWaybillItem.DiscountPercent                       = ((objItem["WaybItem_Discount"] != System.DBNull.Value) ? System.Convert.ToDouble(objItem["WaybItem_Discount"]) : 0);
                        objWaybillItem.PriceWithDiscount                     = ((objItem["WaybItem_DiscountPrice"] != System.DBNull.Value) ? System.Convert.ToDouble(objItem["WaybItem_DiscountPrice"]) : 0);
                        objWaybillItem.PriceInAccountingCurrency             = ((objItem["WaybItem_CurrencyPrice"] != System.DBNull.Value) ? System.Convert.ToDouble(objItem["WaybItem_CurrencyPrice"]) : 0);
                        objWaybillItem.PriceWithDiscountInAccountingCurrency = ((objItem["WaybItem_CurrencyDiscountPrice"] != System.DBNull.Value) ? System.Convert.ToDouble(objItem["WaybItem_CurrencyDiscountPrice"]) : 0);


                        if (objWaybillItem != null)
                        {
                            objList.Add(objWaybillItem);
                        }
                    }
                }

                dtList = null;
            }
            catch (System.Exception f)
            {
                strErr += (String.Format("\nНе удалось получить приложение к накладной.\nТекст ошибки: {0}", f.Message));
            }
            return(objList);
        }