Esempio n. 1
0
        /// <summary>
        /// Finishes the clearing through customs procedure.
        /// </summary>
        /// <param name="good">The good.</param>
        public void FinishClearingThroughCustoms(SADGood good)
        {
            Clearence2SadGoodID = good;
            SADDocumentType sadDocument = good.SADDocumentIndex;

            DocumentNo      = sadDocument.DocumentNumber;
            ReferenceNumber = sadDocument.ReferenceNumber;
            SPStatus        = true;
        }
Esempio n. 2
0
        private void AssignSADGood(Entities edc, SADGood sadGood)
        {
            switch (this.DisposalStatus.Value)
            {
            case Linq.DisposalStatus.SHMenthol:
            case Linq.DisposalStatus.Tobacco:
            case Linq.DisposalStatus.Overuse:
                this.Disposal2PCNID = Disposal2IPRIndex.IPR2PCNPCN;
                break;

            case Linq.DisposalStatus.Dust:
            case Linq.DisposalStatus.Waste:
            case Linq.DisposalStatus.Cartons:
            case Linq.DisposalStatus.TobaccoInCigaretes:
            case Linq.DisposalStatus.TobaccoInCigaretesDestinationEU:
            case Linq.DisposalStatus.TobaccoInCigaretesProduction:
            case Linq.DisposalStatus.TobaccoInCutfiller:
            case Linq.DisposalStatus.TobaccoInCutfillerDestinationEU:
            case Linq.DisposalStatus.TobaccoInCutfillerProduction:
                string  _productCodeNumber = sadGood.PCNTariffCode;
                PCNCode _pcn = PCNCode.Find(edc, IsDisposal, _productCodeNumber);
                if (_pcn == null)
                {
                    string _mtmp = "Cannot find pcn code: {0} for the good: {1} with IsDisposal set to {2}";
                    throw new InputDataValidationException(
                              "wrong PCN code in customs message", "PCN Code",
                              string.Format(_mtmp, _productCodeNumber, sadGood.GoodsDescription, IsDisposal),
                              true);
                }
                this.Disposal2PCNID = _pcn;
                break;

            case Linq.DisposalStatus.Invalid:
            case Linq.DisposalStatus.None:
            default:
                break;
            }
            this.SADDate          = sadGood.SADDocumentIndex.CustomsDebtDate;
            this.SADDocumentNo    = sadGood.SADDocumentIndex.DocumentNumber;
            this.CustomsProcedure = sadGood.SPProcedure;
            //TODO remove it
            if (this.JSOXCustomsSummaryIndex == null)
            {
                return;
            }
            this.JSOXCustomsSummaryIndex.SADDate = sadGood.SADDocumentIndex.CustomsDebtDate;
            this.JSOXCustomsSummaryIndex.ExportOrFreeCirculationSAD = sadGood.SADDocumentIndex.DocumentNumber;
            this.JSOXCustomsSummaryIndex.CustomsProcedure           = sadGood.SPProcedure;
            this.JSOXCustomsSummaryIndex.CompensationGood           = this.Disposal2PCNID.CompensationGood;
            this.JSOXCustomsSummaryIndex.RemainingQuantity          = this.RemainingQuantity;
        }
Esempio n. 3
0
        internal void AddDisposal(Entities edc, DisposalEnum kind, ref decimal toDispose, Material material, InvoiceContent invoiceContent, NamedTraceLogger.TraceAction trace)
        {
            trace("Entering IPR.AddDisposal", 421, TraceSeverity.Verbose);
            Disposal _dsp = AddDisposal(edc, kind, ref toDispose);

            _dsp.Material = material;
            _dsp.ClearThroughCustom(invoiceContent, _x => { });
            SADGood _sg = invoiceContent.InvoiceIndex.ClearenceIndex.Clearence2SadGoodID;

            if (_sg != null)
            {
                _dsp.FinishClearingThroughCustoms(edc, _sg, trace);
            }
        }
Esempio n. 4
0
        internal void FinishClearingThroughCustoms(Entities edc, SADGood sadGood, NamedTraceLogger.TraceAction trace)
        {
            string _at = "starting";

            if (this.CustomsStatus.Value == Linq.CustomsStatus.Finished)
            {
                return;
            }
            try
            {
                _at = "Disposal _lastOne";
                IEnumerable <Disposal> _lastOne = from _dsp in this.Disposal2IPRIndex.Disposals(edc, trace)
                                                  where _dsp.CustomsStatus.Value == Linq.CustomsStatus.Finished
                                                  select _dsp;
                if (_lastOne.Count <Disposal>() == 0)
                {
                    this.SPNo = 1;
                }
                else
                {
                    this.SPNo = _lastOne.Max <Disposal>(dspsl => dspsl.SPNo.Value) + 1;
                }
                decimal _balance = CalculateRemainingQuantity();
                if (_balance == 0)
                {
                    this.ClearingType = Linq.ClearingType.TotalWindingUp;
                }
                else
                {
                    this.ClearingType = Linq.ClearingType.PartialWindingUp;
                }
                AssignSADGood(edc, sadGood);
                this.CustomsStatus = Linq.CustomsStatus.Finished;
            }
            catch (Exception _ex)
            {
                string _template = "Cannot finish Export of disposal {0} {1} because of internal error: {2} at: {3}";
                _template = String.Format(_template, this.Title, this.Id.Value, _ex.Message, _at);
                trace("Exception at Disposal.FinishClearingThroughCustoms", 181, TraceSeverity.High);
                throw GenericStateMachineEngine.ActionResult.Exception(_ex, _template);
            }
        }
Esempio n. 5
0
 /// <summary>
 /// Clears through customs.
 /// </summary>
 /// <param name="entities">The entities.</param>
 /// <param name="sadGood">The sad good.</param>
 /// <param name="trace">The trace action.</param>
 public void FinishClearingThroughCustoms(Entities entities, SADGood sadGood, NamedTraceLogger.TraceAction trace)
 {
     trace("Entering Clearence.FinishClearingThroughCustoms", 64, TraceSeverity.Verbose);
     Clearence2SadGoodID = sadGood;
     FinishClearingThroughCustoms(entities, trace);
 }
Esempio n. 6
0
        /// <summary>
        /// Creates the clearance.
        /// </summary>
        /// <param name="entities">The entities.</param>
        /// <param name="procedure">The procedure.</param>
        /// <param name="procedureCode">The procedure code.</param>
        /// <param name="good">The good.</param>
        /// <returns></returns>
        public static Clearence CreataClearance(Entities entities, string procedure, ClearenceProcedure procedureCode, SADGood good)
        {
            Clearence _newClearance = CreateClearance(procedure, procedureCode);

            _newClearance.Clearence2SadGoodID = good;
            _newClearance.DocumentNo          = good.SADDocumentIndex.DocumentNumber;
            _newClearance.ReferenceNumber     = good.SADDocumentIndex.ReferenceNumber;
            _newClearance.UpdateTitle(entities);
            entities.Clearence.InsertOnSubmit(_newClearance);
            entities.SubmitChanges();
            _newClearance.UpdateTitle(entities);
            return(_newClearance);
        }