internal void CreateJSOXReport(JSOXLib previous) { PreviousMonthDate = previous.BalanceDate.GetValueOrDefault(DateTime.Today.Date - TimeSpan.FromDays(30)); PreviousMonthQuantity = previous.SituationQuantity.GetValueOrDefault(-1); this.BalanceDate = DateTime.Today.Date; this.SituationDate = this.BalanceDate; this.JSOXLibraryReadOnly = false; }
/// <summary> /// Gets the entries4 JSOX. /// </summary> /// <param name="edc">The <see cref="Entities"/>.</param> /// <param name="parent">The parent.</param> /// <returns>The collection of <see cref="Disposal"/> that must be added to JSOX report.</returns> public static IQueryable <Disposal> GetEntries4JSOX(Entities edc, JSOXLib parent) { return(from _dspx in edc.Disposal where (_dspx.DisposalStatus.Value != Linq.DisposalStatus.Cartons) && (!_dspx.JSOXReportID.HasValue || _dspx.JSOXReportID.Value == parent.Id.Value) && (_dspx.CustomsStatus.Value == Linq.CustomsStatus.Finished) orderby _dspx.Disposal2IPRIndex.Title select _dspx); }
/// <summary> /// Gets the introducing quantity. /// </summary> /// <param name="edc">The edc.</param> /// <param name="parent">The parent.</param> /// <param name="dateStart">The date start.</param> /// <param name="dateEnd">The date end.</param> /// <returns></returns> public static decimal GetIntroducingData(Entities edc, JSOXLib parent, out DateTime dateStart, out DateTime dateEnd) { decimal _ret = 0; dateEnd = LinqIPRExtensions.DateTimeMinValue; dateStart = LinqIPRExtensions.DateTimeMaxValue; foreach (IPR _iprx in parent.IPR(edc)) { _ret += _iprx.NetMassDec; dateEnd = LinqIPRExtensions.Max(_iprx.CustomsDebtDate.Value.Date, dateEnd); dateStart = LinqIPRExtensions.Min(_iprx.CustomsDebtDate.Value.Date, dateStart); } foreach (IPR _iprx in IPR.GetAllNew4JSOX(edc)) { _iprx.IPR2JSOXIndex = parent; _ret += _iprx.NetMassDec; dateEnd = LinqIPRExtensions.Max(_iprx.CustomsDebtDate.Value.Date, dateEnd); dateStart = LinqIPRExtensions.Min(_iprx.CustomsDebtDate.Value.Date, dateStart); } return(_ret); }
internal static BalanceBatchWrapper Create(Entities edc, IGrouping <string, IPR> iprGroups, JSOXLib parent, StockDictionary.BalanceStock balanceStock, NamedTraceLogger.TraceAction trace) { trace("Entering BalanceBatch.Create", 34, TraceSeverity.Verbose); BalanceBatchWrapper _ret; try { IPR _firsTIPR = iprGroups.FirstOrDefault <IPR>(); BalanceBatch _newBB = new BalanceBatch() { Archival = false, Balance2JSOXLibraryIndex = parent, Batch = iprGroups.Key, Title = "creating", SKU = _firsTIPR == null ? "NA" : _firsTIPR.SKU, }; edc.BalanceBatch.InsertOnSubmit(_newBB); List <BalanceIPR> _is = new List <BalanceIPR>(); _newBB.Update(edc, iprGroups, balanceStock, _is, trace); _ret = new BalanceBatchWrapper() { iprCollection = _is.ToArray <BalanceIPR>(), batch = _newBB }; } catch (CAS.SharePoint.ApplicationError) { throw; } catch (Exception ex) { trace("ApplicationError at BalanceBatch.Create", 58, TraceSeverity.High); throw new SharePoint.ApplicationError("BalanceBatch.Create", "Body", ex.Message, ex); } trace("Finished BalanceBatch.Create", 61, TraceSeverity.Verbose); return(_ret); }
internal static IPR.Balance Create(Entities edc, IPR _iprAccount, BalanceBatch parent, JSOXLib masterReport, List <BalanceIPR> iprCollection, NamedTraceLogger.TraceAction trace) { trace("Entering BalanceIPR.Create", 30, TraceSeverity.Verbose); BalanceIPR _newItem = new BalanceIPR() { Archival = false, Balance = -1, BalanceBatchIndex = parent, BalanceIPR2JSOXIndex = masterReport, Batch = _iprAccount.Batch, CustomsProcedure = _iprAccount.ClearenceIndex.ClearenceProcedure.ToString(), DocumentNo = _iprAccount.DocumentNo, InvoiceNo = _iprAccount.InvoiceNo, IPRIndex = _iprAccount, OGLIntroduction = _iprAccount.DocumentNo, SKU = _iprAccount.SKU, Title = "Creating", }; edc.BalanceIPR.InsertOnSubmit(_newItem); iprCollection.Add(_newItem); return(_newItem.Update(edc, trace)); }