public Billing CreateVOneBilling( int departmentId, int companyId, int loginUserId, int currencyId, WebApiMFExtractSetting extractSetting, department department) { var billing = new Billing { CompanyId = companyId, CurrencyId = currencyId, BillingCategoryId = extractSetting.BillingCategoryId.Value, InputType = 1, BilledAt = billing_date, ClosingAt = billing_date, SalesAt = sales_date, DueAt = due_date, BillingAmount = total_price, RemainAmount = total_price, Approved = 1, InvoiceCode = GetTriming(billing_number, 100), TaxClassId = (int)TaxClassId.NotCovered, Note1 = GetTriming($"No.{billing_number} {partner_name}", 100), Note2 = GetTriming(memo, 100), Note3 = department == null ? string.Empty : GetTriming(department.name, 100), Note4 = department == null ? string.Empty : GetTriming($"{department.person_name} {department.email}", 100), Note5 = GetTriming(string.Join(" ", tags), 100), Note6 = GetTriming(partner_name, 100), Note7 = string.Empty, Note8 = string.Empty, Price = 0M, CreateBy = loginUserId, UpdateBy = loginUserId, //便宜的にCustomerKanaにidを入れる。MFBillingテーブルへデータ登録時、利用するため CustomerKana = id, }; if (Customer == null) { billing.CustomerCode = CustomerCode; } else { billing.CustomerId = Customer.Id; billing.DepartmentId = departmentId; billing.StaffId = Customer.StaffId; billing.CollectCategoryId = Customer.CollectCategoryId; } return(billing); }
private void SetControlValues() { Setting = GetWebApiSetting().ExtractSetting.ConvertToModel <WebApiMFExtractSetting>(); if (Setting == null) { Setting = new WebApiMFExtractSetting(); return; } if (Setting.BillingCategoryId.HasValue) { var billingCategory = GetCategory(Setting.BillingCategoryId.Value); if (billingCategory != null) { txtBillingCategory.Text = billingCategory.Code; selectedBillingCategoryCode = billingCategory.Code; lblBillingCategoryName.Text = billingCategory.Name; } } if (Setting.StaffId.HasValue) { var staff = GetStaff(Setting.StaffId.Value); if (staff != null) { txtStaffCode.Text = staff.Code; selectedstaffCode = staff.Code; lblStaffName.Text = staff.Name; } } txtClosingDay.Text = Setting.ClosingDay.ToString().PadLeft(2, '0'); if (txtClosingDay.Text == "00") { cbxIssueBillEachTime.Checked = true; } txtCollectOffsetMonth.Text = Setting.CollectOffsetMonth.ToString().PadLeft(2, '0'); txtCollectOffsetDay.Text = Setting.CollectOffsetDay.ToString().PadLeft(2, '0'); if (Setting.CollectCategoryId.HasValue) { for (int i = 0; i < cmbCollectCategoryId.Items.Count; i++) { var selected = cmbCollectCategoryId.Items[i].Tag as Category; if (selected.Id == Setting.CollectCategoryId) { cmbCollectCategoryId.SelectedIndex = i; break; } } } }
public Customer BuildNewCustomer(WebApiMFExtractSetting setting, partner partner, int companyId, int loginUserId, IEnumerable <string> legalPersonalities) { var department = partner == null ? null : partner.departments.FirstOrDefault(); var customer = new Customer { CompanyId = companyId, Code = CustomerCode, Name = GetTriming(partner_name, 140), Kana = partner == null ? dummyKana : GetTriming(GetCustomerNameKana(partner.name_kana, legalPersonalities), 140), PostalCode = department == null ? string.Empty : GetTriming(department.zip, 10), Address1 = department == null ? string.Empty : GetTriming(department.address1, 40), Address2 = department == null ? string.Empty : GetTriming(department.address2, 40), Tel = department == null ? string.Empty : GetTriming(department.tel, 20), CustomerStaffName = partner == null ? string.Empty : GetTriming(partner.departments.FirstOrDefault().person_name, 40), Note = partner == null ? string.Empty : GetTriming(partner.memo, 100), ClosingDay = setting.ClosingDay.Value, CollectCategoryId = setting.CollectCategoryId.Value, CollectOffsetMonth = setting.CollectOffsetMonth.Value, CollectOffsetDay = setting.CollectOffsetDay.Value, StaffId = setting.StaffId.Value, ReceiveAccountId1 = 1, ReceiveAccountId2 = 1, ReceiveAccountId3 = 1, UseKanaLearning = 1, CollationKey = department == null ? string.Empty : GetTriming(department.tel, 48), CreateBy = loginUserId, UpdateBy = loginUserId, }; return(customer); }