internal static CustomsWarehouseDisposal Create(DisposalRequestDetails disposalRequestDetails, int disposalRequestLibId, CustomsWarehouse account, string customsProcedure)
        {
            Debug.Assert(account != null, "Disposal have to has account assigned.");
            CustomsWarehouseDisposal _newItem = new CustomsWarehouseDisposal()
            {
                Archival            = false,
                CNIDId              = account.CNIDId,
                ClearingType        = Linq.ClearingType.PartialWindingUp,
                CustomsStatus       = Linq.CustomsStatus.NotStarted,
                CustomsProcedure    = customsProcedure,
                CW_AddedKg          = 0, //Assigned in Recalculate
                CW_DeclaredNetMass  = 0,
                CW_SettledNetMass   = 0, //Assigned in Recalculate
                CW_SettledGrossMass = 0, //Assigned in Recalculate
                CW_PackageToClear   = 0, //Assigned in Recalculate
                TobaccoValue        = 0, //Assigned in Recalculate
                DisposalRequestId   = disposalRequestLibId,
                CWL_CWDisposal2CustomsWarehouseID = account,
                SKUDescription = "N/A",
                Title          = "ToDo",
                SADDate        = Extensions.SPMinimum,
            };

            _newItem.Recalculate(disposalRequestDetails);
            _newItem.Title = String.Format("CW-{0:D4}-{1}", DateTime.Today.Year, "XXXXXX"); //TODO Id.Value);
            return(_newItem);
        }
예제 #2
0
 /// <summary>
 /// Creates the instance of <see cref="DisposalRequestDetails" /> to be used as a wrapper of <see cref="CustomsWarehouseDisposal" />.
 /// </summary>
 /// <param name="parent">The parent.</param>
 /// <param name="disposal">The disposal to be wrapped.</param>
 /// <param name="sequenceNumber">The sequence number that will be incremented each time new instance is created.</param>
 internal DisposalRequestDetails(DisposalRequest parent, CustomsWarehouseDisposal disposal, ref int sequenceNumber)
     : this(parent, disposal.CWL_CWDisposal2CustomsWarehouseID, ref sequenceNumber)
 {
     AddedKg                    = disposal.CW_AddedKg.Value;
     CustomsProcedure           = disposal.CustomsProcedure;
     DeclaredNetMass            = disposal.CW_DeclaredNetMass.Value;
     SKUDescription             = disposal.SKUDescription;
     m_Disposal                 = disposal;
     QuantityyToClearSum        = AddedKg + DeclaredNetMass;
     PackagesToDispose          = m_Account.Packages(QuantityyToClearSum);
     QuantityyToClearSumRounded = PackagesToDispose * MassPerPackage;
     TotalStock                 = disposal.CWL_CWDisposal2CustomsWarehouseID.TobaccoNotAllocated.Value + QuantityyToClearSumRounded;
 }
예제 #3
0
 internal void UpdateDisposal(int disposalRequestLibId, List <CustomsWarehouseDisposal> list2Delete, List <CustomsWarehouseDisposal> list2Insert)
 {
     if (QuantityyToClearSumRounded > 0)
     {
         if (m_Disposal == null)
         {
             m_Disposal = CustomsWarehouseDisposal.Create(this, disposalRequestLibId, m_Account, CustomsProcedure);
             list2Insert.Add(m_Disposal);
         }
         else
         {
             m_Disposal.Update(this);
         }
     }
     else if (m_Disposal != null)
     {
         m_Disposal.DeleteDisposal();
         list2Delete.Add(m_Disposal);
     }
 }
예제 #4
0
        /// <summary>
        /// Creates an instance of <see cref="DisposalRequest" /> using the collection of <see cref="CustomsWarehouse" /> and existing <see cref="CustomsWarehouseDisposal" /> entries.
        /// </summary>
        /// <param name="listOfAccounts">The list of <see cref="CustomsWarehouse" /> with the same batch.</param>
        /// <param name="groupOfDisposals">The group of existing <see cref="CustomsWarehouseDisposal" /> for the selected Batch.</param>
        /// <param name="notify">The notify.</param>
        /// <returns></returns>
        internal static DisposalRequest Create(List <CustomsWarehouse> listOfAccounts, IGrouping <string, CustomsWarehouseDisposal> groupOfDisposals, Action <DisposalRequest, PropertyChangedEventArgs> notify)
        {
            CustomsWarehouseDisposal _firstDisposal = groupOfDisposals.First <CustomsWarehouseDisposal>();

            return(Create(listOfAccounts, groupOfDisposals, _firstDisposal.SKUDescription, _firstDisposal.CustomsProcedure, notify));
        }