public Task <IEnumerable <BillingInvoice> > UpdateBillingForPublishNewInputId( BillingInvoiceForPublish billingInvoiceForPublish, bool DoUpdateInvoiceCode, CancellationToken token = default(CancellationToken)) { return(dbHelper.GetItemsAsync <BillingInvoice>( GetQueryUpdateBillingForPublishByTemporaryId(DoUpdateInvoiceCode), billingInvoiceForPublish, token)); }
/// <summary>??? </summary> /// <param name="billing"></param> /// <returns></returns> private InvoiceNumberHistory GetKeysForNumberingHistory(BillingInvoiceForPublish billing) { var history = new InvoiceNumberHistory { CompanyId = billing.CompanyId }; if (invoiceNumberSetting.ResetType == (int)ResetType.Max) { if (invoiceNumberSetting.FormatType == (int)FormatType.NumberAndFixedString && invoiceNumberSetting.FixedStringType == (int)FixedStringType.isFixed) { history.FixedString = invoiceNumberSetting.FixedString; return(history); } else if (invoiceNumberSetting.FormatType == (int)FormatType.NumberAndFixedString && invoiceNumberSetting.FixedStringType != (int)FixedStringType.isFixed) { history.FixedString = billing.InvoiceTemplateFixedString; return(history); } else if (invoiceNumberSetting.FormatType == (int)FormatType.OnlyNumber) { return(history); } } var targetDate = invoiceNumberSetting.DateType == (int)DateType.BilledAt ? billing.BilledAt : billing.ClosingAt; var year = targetDate.Year; var month = targetDate.Month; if (invoiceNumberSetting.ResetType == (int)(ResetType.Year)) { //var targetYear = targetDate.Year; //var targetMonth = targetDate.Month; var x = (invoiceNumberSetting.ResetMonth.Value - 1); if (month <= x) { history.NumberingYear = (year - 1).ToString(); } else { history.NumberingYear = targetDate.ToString("yyyy"); } return(history); } else { history.NumberingYear = year.ToString("0000"); history.NumberingMonth = month.ToString("00"); return(history); } }
public Task <IEnumerable <Billing> > UpdateForPublishAsync(BillingInvoiceForPublish billingInvoiceForPublish, bool doUpdateInvoiceCode, CancellationToken token = default(CancellationToken)) { var query = $@" Update Billing SET DestinationId = @DestinationId {(doUpdateInvoiceCode ? " , InvoiceCode = @InvoiceCode" : string.Empty)} OUTPUT INSERTED.* FROM Billing b WHERE b.BillingInputId = @BillingInputId "; return(dbHelper.GetItemsAsync <Billing>(query, billingInvoiceForPublish, token)); }
public Task <IEnumerable <Billing> > UpdateBillingForPublishAsync(BillingInvoiceForPublish billingInvoiceForPublish, bool doUpdateInvoiceCode, CancellationToken token = default(CancellationToken)) => billingQueryProcessor.UpdateForPublishAsync(billingInvoiceForPublish, doUpdateInvoiceCode, token);
private string GetNewInvoiceCode(BillingInvoiceForPublish billing, InvoiceNumberHistory condition, InvoiceNumberHistory history) { var invoiceCode = ""; //最大まで到達したらリセット if (history.LastNumber >= MaxNumber) { history.LastNumber = 1; } else { history.LastNumber++; } //前ゼロ処理 if (invoiceNumberSetting.ZeroPadding == 0) { invoiceCode += history.LastNumber.ToString(); } else { invoiceCode += history.LastNumber.ToString().PadLeft(invoiceNumberSetting.Length, '0'); } //連番のみ if (invoiceNumberSetting.FormatType == (int)FormatType.OnlyNumber) { return(invoiceCode); } var formatString = string.Empty; //日付を使用 if (invoiceNumberSetting.FormatType == (int)FormatType.NumberAndDate) { var targetDate = invoiceNumberSetting.DateType == (int)DateType.BilledAt ? billing.BilledAt : billing.ClosingAt; if (invoiceNumberSetting.DateFormat == (int)DateFormat.yyyy) { formatString = condition.NumberingYear; } else { formatString = condition.NumberingYear + condition.NumberingMonth; } } //固定文字を使用 else { //完全固定 if (invoiceNumberSetting.FixedStringType == (int)FixedStringType.isFixed) { formatString = invoiceNumberSetting.FixedString; } //文面パターンごとに固定 else { formatString = billing.InvoiceTemplateFixedString; } } invoiceCode = GetDisplayFormat(invoiceCode, formatString); return(invoiceCode); }