public WinAddEditDrCrNote(String md, AccountDocumentType docType, ObservableCollection <MBaseModel> pItems, MAccountDoc actView) { dt = docType; actualView = actView; parentItemsSource = pItems; Mode = md; vw = new MAccountDoc(new CTable("")); vw.VATType = CGlobalVariable.GetGlobalVariableValue("DEFAULT_VAT_TYPE_SALE"); //บางครั้งการรับเงินจากลูกค้าล่วงหน้า จะให้ตรงนี้เป็น false แต่ว่าต้องไปรับเข้าเงินสดเองเพื่อให้บัญชี balance //รายการตรงนี้ จะไม่ถูกดึงไปคิด ตอนทำภาษีหัก ณ ที่จ่าย หรือ vat เพราะว่า ไม่ได้เป็นส่วนของรายรับ/จ่าย vw.ForExpenseRevenue = true; if (md.Equals("A") && (actView != null)) { //use actView as default value vw.BranchId = actView.BranchId; vw.BranchCode = actView.BranchCode; vw.BranchName = actView.BranchName; vw.EntityId = actView.EntityId; vw.EntityCode = actView.EntityCode; vw.EntityName = actView.EntityName; } DataContext = vw; vw.IsVatClaimable = true; vw.DocumentType = ((int)dt).ToString(); InitializeComponent(); }
private void LoadData() { isInLoad = true; this.Title = Caption; lkup.Focus(); CTable t = new CTable(""); vw = new MAccountDocItem(t); vw.CreateDefaultValue(); DataContext = vw; CUtil.EnableForm(false, this); if (Mode.Equals("E")) { CTable newDB = actualView.GetDbObject().Clone(); vw.SetDbObject(newDB); lkup.Lookup = selectionTypeToLookup(vw.SelectType); vw.NotifyAllPropertiesChanged(); } else { vw.SelectType = CGlobalVariable.GetGlobalVariableValue("DEFAULT_SELECTION_TYPE_PERCHASE"); lkup.Lookup = selectionTypeToLookup(vw.SelectType); } vw.IsModified = false; CUtil.EnableForm(true, this); isInLoad = false; }
public WinAddEditDrCrNoteApproved(String md, AccountDocumentType docType, ObservableCollection <MBaseModel> pItems, MAccountDoc actView) { dt = docType; actualView = actView; parentItemsSource = pItems; Mode = md; vw = new MAccountDoc(new CTable("")); vw.VATType = CGlobalVariable.GetGlobalVariableValue("DEFAULT_VAT_TYPE_SALE"); if (md.Equals("A") && (actView != null)) { //use actView as default value vw.BranchId = actView.BranchId; vw.BranchCode = actView.BranchCode; vw.BranchName = actView.BranchName; vw.EntityId = actView.EntityId; vw.EntityCode = actView.EntityCode; vw.EntityName = actView.EntityName; } DataContext = vw; vw.DocumentType = ((int)dt).ToString(); InitializeComponent(); }
private void LoadData() { //isInLoad = true; this.Title = Caption; CTable t = new CTable(""); vw = new MPaymentCriteria(t); vw.CreateDefaultValue(); DataContext = vw; CUtil.EnableForm(false, this); if (Mode.Equals("E")) { CTable newDB = actualView.GetDbObject().Clone(); vw.SetDbObject(newDB); } else { vw.VatPercent = CGlobalVariable.GetGlobalVariableValue("VAT_PERCENTAGE"); vw.WhPercent = "3"; } vw.NotifyAllPropertiesChanged(); vw.IsModified = false; CUtil.EnableForm(true, this); //isInLoad = false; }
private void LoadData() { isInLoadData = true; this.Title = Caption; dtFromDate.Focus(); vw.CreateDefaultValue(); CUtil.EnableForm(false, this); if (Mode.Equals("E")) { CTable m = getDocInfoWrapper(); if (m != null) { vw.SetDbObject(m); vw.InitAuxilaryDocItem(); vw.InitPaymentCriteria(); String tmp = vw.EntityAddressID; vw.InitEntityAddresses(); vw.EntityAddressID = tmp; tmp = vw.EntityBankAccountID; vw.InitEntityBankAccounts(); vw.EntityBankAccountID = tmp; vw.AddressObj = CUtil.MasterIDToObject(vw.EntityAddresses, vw.EntityAddressID); vw.NotifyAllPropertiesChanged(); } } else if (Mode.Equals("A")) { vw.DocumentDate = DateTime.Now; vw.VatPct = CGlobalVariable.GetGlobalVariableValue("VAT_PERCENTAGE"); vw.VatType = CGlobalVariable.GetGlobalVariableValue("DEFAULT_VAT_TYPE_PERCHASE"); vw.NoteWidthCm = "10.00"; vw.NoteHeightCm = "7.00"; vw.NoteTopCm = "12.00"; vw.NoteLeftCm = "1.00"; vw.IsNoteStick = false; ObservableCollection <MMasterRef> branches = CMasterReference.Instance.Branches; if (branches.Count > 1) { MMasterRef b = branches[1]; cboBranch.SelectedObject = b; } vw.IsPoInvoiceRefByItem = true; } vw.IsModified = false; isInLoadData = false; CUtil.EnableForm(true, this); }
private void LoadData() { isInLoadData = true; this.Title = Caption; dtFromDate.Focus(); vw.CreateDefaultValue(); CUtil.EnableForm(false, this); if (Mode.Equals("E")) { CTable m = getDocInfoWrapper(); if (m != null) { vw.SetDbObject(m); vw.InitAccountDocItem(); vw.InitAccountDocPayment(); String tmp = vw.EntityAddressID; vw.InitEntityAddresses(); vw.EntityAddressID = tmp; vw.AddressObj = CUtil.MasterIDToObject(vw.EntityAddresses, vw.EntityAddressID); vw.BillSimulate.InitPromotionItems(); vw.BillSimulate.InitSelectedItems(); vw.NotifyAllPropertiesChanged(); } vw.IsModified = false; } else if (Mode.Equals("A")) { vw.DocumentDate = DateTime.Now; vw.VAT_PCT = CGlobalVariable.GetGlobalVariableValue("VAT_PERCENTAGE"); vw.VATType = CGlobalVariable.GetGlobalVariableValue("DEFAULT_VAT_TYPE_SALE"); vw.AllowCashNegative = CGlobalVariable.IsCashNegativeAllow(); vw.AllowARAPNegative = CGlobalVariable.IsArApNegativeAllow(); vw.AllowInventoryNegative = CGlobalVariable.IsInventoryNegativeAllow(); vw.IsModified = (actualView != null); } isInLoadData = false; CUtil.EnableForm(true, this); }
private void addItemFromPayroll(ArrayList arr, int type) { String projectVariable = "PAYROLL_PROJECT_CODE"; String serviceVariable = "PAYROLL_SERVICE_CODE"; if (type == 2) { serviceVariable = "SOCIAL_SECURITY_SERVICE_CODE"; } String projectCode = CGlobalVariable.GetGlobalVariableValue(projectVariable); CTable p = getObject(projectCode, "PROJECT_CODE", "GetProjectList", "PROJECT_LIST"); MProject pj = new MProject(p); String serviceCode = CGlobalVariable.GetGlobalVariableValue(serviceVariable); CTable s = getObject(serviceCode, "SERVICE_CODE", "GetServiceList", "SERVICE_LIST"); MService sv = new MService(s); foreach (MVPayrollDocument pd in arr) { CTable t = new CTable(""); MAccountDocItem mdi = new MAccountDocItem(t); mdi.CreateDefaultValue(); mdi.SelectType = "1"; mdi.ServiceObj = sv; mdi.ProjectObj = pj; vw.AddAccountDocItem(mdi); MAuxilaryDocSubItem mi = new MAuxilaryDocSubItem(new CTable("")); mi.Description = String.Format("{0}-{1} {2}", pd.FromSalaryDateFmt, pd.ToSalaryDateFmt, pd.EmployeeTypeDesc); mi.SubItemDate = pd.ToSalaryDate; mi.UnitPrice = pd.ReceiveAmount; if (type == 2) { mi.UnitPrice = pd.SocialSecurityCompanyAmount; } mi.Quantity = "1.00"; mdi.AddItemDetail(mi); mdi.CalculateSubItemTotal(); mdi.SerializeItemDetails(); } }
private void LoadData() { isInLoadData = true; this.Title = Caption; dtFromDate.Focus(); vw.CreateDefaultValue(); CUtil.EnableForm(false, this); if (Mode.Equals("E")) { //CTable m = OnixWebServiceAPI.GetAccountDocInfo(actualView.GetDbObject()); CTable m = getDocInfoWrapper(); if (m != null) { vw.SetDbObject(m); vw.InitAccountDocReceipt(); vw.InitAccountDocPayment(); String tmp = vw.EntityAddressID; vw.InitEntityAddresses(); vw.EntityAddressID = tmp; vw.AddressObj = CUtil.MasterIDToObject(vw.EntityAddresses, vw.EntityAddressID); vw.NotifyAllPropertiesChanged(); } } else if (Mode.Equals("A")) { vw.DocumentDate = DateTime.Now; vw.VAT_PCT = CGlobalVariable.GetGlobalVariableValue("VAT_PERCENTAGE");; vw.AllowCashNegative = CGlobalVariable.IsCashNegativeAllow(); vw.AllowARAPNegative = CGlobalVariable.IsArApNegativeAllow(); vw.AllowInventoryNegative = CGlobalVariable.IsInventoryNegativeAllow(); vw.IsWhPayType1 = true; } vw.IsModified = false; isInLoadData = false; CUtil.EnableForm(true, this); }
public static MAccountDoc TaxDocToAccountDoc(MVTaxDocument td, UIElement parent) { MAccountDoc ad = new MAccountDoc(new CTable("")); if (td.ChequeID.Equals("")) { String supplierCode = CGlobalVariable.GetGlobalVariableValue("REVENUE_DEP_SUPPLIER_CODE"); if (supplierCode.Equals("")) { CHelper.ShowErorMessage("REVENUE_DEP_SUPPLIER_CODE", "error_revenue_dep_code_missing", null); return(null); } MEntity en = new MEntity(new CTable("")); en.EntityCode = supplierCode; en.Category = "2"; CUtil.EnableForm(false, parent); ArrayList arr = OnixWebServiceAPI.GetListAPI("GetEntityList", "ENTITY_LIST", en.GetDbObject()); CUtil.EnableForm(true, parent); if ((arr == null) || (arr.Count <= 0)) { CHelper.ShowErorMessage(supplierCode, "error_supplier_code_missing", null); return(null); } CTable obj = (CTable)arr[0]; en.SetDbObject(obj); ad.EntityObj = en; ad.EntityName = en.EntityName; } else { ad.ChequeID = td.ChequeID; } ad.IsPopulateChequeAmt = true; return(ad); }
private void LoadData() { isInLoadData = true; this.Title = Caption; dtFromDate.Focus(); vw.CreateDefaultValue(); CUtil.EnableForm(false, this); if (Mode.Equals("E")) { CTable m = getDocInfoWrapper(); if (m != null) { vw.SetDbObject(m); vw.InitAuxilaryDocItem(); vw.InitRemarks(); quotationType = vw.QuotationType; String tmp = vw.EntityAddressID; vw.InitEntityAddresses(); vw.EntityAddressID = tmp; vw.AddressObj = CUtil.MasterIDToObject(vw.EntityAddresses, vw.EntityAddressID); vw.NotifyAllPropertiesChanged(); } } else if (Mode.Equals("A")) { vw.DocumentDate = DateTime.Now; vw.VatPct = CGlobalVariable.GetGlobalVariableValue("VAT_PERCENTAGE"); vw.VatType = CGlobalVariable.GetGlobalVariableValue("DEFAULT_VAT_TYPE_PERCHASE"); } vw.IsModified = false; isInLoadData = false; CUtil.EnableForm(true, this); }
public static CTable ApproveChequeFromAccountDoc(MAccountDoc doc) { CTable dat = new CTable(""); Boolean approveCheque = CGlobalVariable.GetGlobalVariableValue("CHEQUE_APPROVE_IMMEDIATE_FLAG").Equals("Y"); if (!approveCheque) { return(dat); } dat.SetFieldValue("CHEQUE_ID", doc.ChequeID); CTable cheque = OnixWebServiceAPI.SubmitObjectAPI("GetChequeInfo", dat); if (cheque != null) { cheque = OnixWebServiceAPI.SubmitObjectAPI("ApproveCheque", cheque); } return(cheque); }
private void LoadData() { //isInLoadData = true; this.Title = Caption; txtKey.Focus(); vw.CreateDefaultValue(); CUtil.EnableForm(false, this); if (Mode.Equals("E")) { CTable m = OnixWebServiceAPI.GetBranchConfigInfo(actualView.GetDbObject()); if (m != null) { vw.SetDbObject(m); vw.InitBranchPOSs(); vw.NotifyAllPropertiesChanged(); } } else if (Mode.Equals("A")) { vw.DocNoCashPattern = CGlobalVariable.GetGlobalVariableValue("DOC_NO_CASH_DEFAULT"); vw.DocNoDebtPattern = CGlobalVariable.GetGlobalVariableValue("DOC_NO_DEBT_DEFAULT"); vw.DocNoCashNVPattern = CGlobalVariable.GetGlobalVariableValue("DOC_NO_CASH_DEFAULT_NV"); vw.DocNoDebtNVPattern = CGlobalVariable.GetGlobalVariableValue("DOC_NO_DEBT_DEFAULT_NV"); String SeqLength = CGlobalVariable.GetGlobalVariableValue("DOC_SEQ_LENGTH_DEFAULT"); vw.DocNoCashSeqLength = SeqLength; vw.DocNoDebtSeqLength = SeqLength; vw.DocNoCashNVSeqLength = SeqLength; vw.DocNoDebtNVSeqLength = SeqLength; String YearOffset = CGlobalVariable.GetGlobalVariableValue("DOC_NO_YEAR_OFFSET_DEFAULT"); vw.DocNoCashYearOffset = YearOffset; vw.DocNoDebtYearOffset = YearOffset; vw.DocNoCashNVYearOffset = YearOffset; vw.DocNoDebtNVYearOffset = YearOffset; String Reset = CGlobalVariable.GetGlobalVariableValue("DOC_NO_RESET_DEFAULT"); if (Reset.Equals("2")) { vw.IsCashVatResetByYear = true; vw.IsDebtVatResetByYear = true; vw.IsCashNoVatResetByYear = true; vw.IsDebtNoVatResetByYear = true; } else if (Reset.Equals("1")) { vw.IsCashVatResetByMonth = true; vw.IsDebtVatResetByMonth = true; vw.IsCashNoVatResetByMonth = true; vw.IsDebtNoVatResetByMonth = true; } //String Account = CGlobalVariable.GetGlobalVariableValue("SALE_PETTY_CASH_ACCT_NO"); //CUtil.LoadCashAccount(cboAccountVat, true, Account); //CUtil.LoadMasterRefCombo(cboBranch, true, MasterRefEnum.MASTER_BRANCH, branchID); } vw.IsModified = false; //isInLoadData = false; CUtil.EnableForm(true, this); }