public IActionResult UpdateVoucherTypes([FromBody] VoucherTypes vouchertype) { if (vouchertype == null) { return(Ok(new APIResponse() { status = APIStatus.PASS.ToString(), response = "Request cannot be null" })); } try { VoucherTypes result = GLHelper.UpdateVoucherType(vouchertype); if (result != null) { return(Ok(new APIResponse() { status = APIStatus.PASS.ToString(), response = result })); } return(Ok(new APIResponse() { status = APIStatus.FAIL.ToString(), response = "Updation failed." })); } catch (Exception ex) { return(Ok(new APIResponse() { status = APIStatus.FAIL.ToString(), response = ex.Message })); } }
public static VoucherTypes RegisterVoucherType(VoucherTypes voucherTypes) { try { using Repository <VoucherTypes> repo = new Repository <VoucherTypes>(); var record = repo.VoucherTypes.OrderByDescending(v => v.AddDate).FirstOrDefault(); if (record != null) { voucherTypes.VoucherCode = CommonHelper.IncreaseCode(record.VoucherCode); } else { voucherTypes.VoucherCode = "1"; } voucherTypes.Active = "Y"; voucherTypes.AddDate = DateTime.Now; repo.VoucherTypes.Add(voucherTypes); if (repo.SaveChanges() > 0) { return(voucherTypes); } return(null); } catch { throw; } }
public IActionResult DeleteVoucherTypes(string code) { if (string.IsNullOrWhiteSpace(code)) { return(Ok(new APIResponse() { status = APIStatus.PASS.ToString(), response = $"{nameof(code)} cannot be null" })); } try { VoucherTypes result = GLHelper.DeleteVoucherType(code); if (result != null) { return(Ok(new APIResponse() { status = APIStatus.PASS.ToString(), response = result })); } return(Ok(new APIResponse() { status = APIStatus.FAIL.ToString(), response = "Deletion failed." })); } catch (Exception ex) { return(Ok(new APIResponse() { status = APIStatus.FAIL.ToString(), response = ex.Message })); } }
public TellerCollectorWindow() { InitializeComponent(); _voucherType = VoucherTypes.OR; _voucherDate = MainController.UserTransactionDate; _voucherNo = 0; _transactionDateAdmin = GlobalSettings.DateOfOpenTransaction; _transactionDateUser = MainController.UserTransactionDate; _modelTellerCollector = new TellerCollector(); _modelTellerCollector.Find(_voucherNo); DataContext = _modelTellerCollector; #region --- Quick Search --- KeyDown += delegate(object sender, KeyEventArgs args) { if (args.Key == Key.F1 && (Keyboard.Modifiers & ModifierKeys.Control) == ModifierKeys.Control) { MainController.SearchMember(); } if (args.Key == Key.F2 && (Keyboard.Modifiers & ModifierKeys.Control) == ModifierKeys.Control) { MainController.SearchAccount(); } }; #endregion }
private List <VoucherTypes> GetSelectedItem() { List <VoucherTypes> items = new List <VoucherTypes>(); VoucherTypes itm = new VoucherTypes(); itm.StartingNo = Convert.ToInt64(uctxtStartingMethod.Text); items.Add(itm); return(items); }
protected internal static int LastDocumentNo(VoucherTypes voucherType) { var sqlBuilder = new StringBuilder(); sqlBuilder.AppendFormat("SELECT IFNULL(MAX(DOC_NUM),0) FROM `{0}`", voucherType); var dataTable = DatabaseController.ExecuteSelectQuery(sqlBuilder.ToString()); return(DataConverter.ToInteger(dataTable.Rows[0][0])); }
public static bool IsVoucherNumberUsed(VoucherTypes voucherType, int documentNo) { var sqlBuilder = new StringBuilder(); sqlBuilder.AppendFormat("SELECT * FROM `{0}` WHERE DOC_NUM = ?DOC_NUM", voucherType.ToString().ToLower()); DataTable dataTable = DatabaseController.ExecuteSelectQuery(sqlBuilder.ToString(), new SqlParameter("?DOC_NUM", documentNo)); return(dataTable.Rows.Count > 0); }
public static int GetLastVoucherNumber(VoucherTypes voucherType) { string sqlCommandText = string.Format( "SELECT IFNULL(MAX(VoucherNumber),0) as VoucherNumber FROM {0} WHERE VoucherType = '{1}'", TableName, voucherType); DataTable dataTable = DatabaseController.ExecuteSelectQuery(sqlCommandText); return(Convert.ToInt32(dataTable.Rows[0]["VoucherNumber"])); }
public static VoucherTypes UpdateVoucherType(VoucherTypes voucherTypes) { try { using Repository <VoucherTypes> repo = new Repository <VoucherTypes>(); repo.VoucherTypes.Update(voucherTypes); if (repo.SaveChanges() > 0) { return(voucherTypes); } return(null); } catch { throw; } }
public static bool IsTransactionHeaderExist(VoucherTypes voucherType, int voucherNumber) { string sqlCommandText = string.Format( "SELECT TransactionHeaderId FROM {0} WHERE VoucherType = ?VoucherType AND VoucherNumber = ?VoucherNumber LIMIT 1", TableName); var sqlParameter = new List <SqlParameter> { new SqlParameter("?VoucherType", voucherType), new SqlParameter("?VoucherNumber", voucherNumber), }; DataTable dataTable = DatabaseController.ExecuteSelectQuery(sqlCommandText, sqlParameter.ToArray()); return(dataTable.Rows.Count != 0); }
public static TransactionHeader GetLastTransactionHeaderByVoucherType(VoucherTypes voucherType) { string sqlCommandText = string.Format( "SELECT * FROM {0} WHERE VoucherType = ?VoucherType ORDER BY VoucherNumber DESC LIMIT 1", TableName); var transactionHeader = new TransactionHeader(); var sqlParameter = new List <SqlParameter> { new SqlParameter("?VoucherType", voucherType), }; DataTable dataTable = DatabaseController.ExecuteSelectQuery(sqlCommandText, sqlParameter.ToArray()); foreach (DataRow dataRow in dataTable.Rows) { transactionHeader.SetPropertiesFromDataRow(dataRow); } return(transactionHeader); }
public IActionResult RegisterVoucherTypes([FromBody] VoucherTypes vouhertype) { if (vouhertype == null) { return(Ok(new APIResponse() { status = APIStatus.FAIL.ToString(), response = "Requst can not be empty." })); } try { if (GLHelper.GetVoucherTypeList(vouhertype.VoucherCode).Count > 0) { return(Ok(new APIResponse() { status = APIStatus.FAIL.ToString(), response = $"Voucher Code ={vouhertype.VoucherCode} alredy exists." })); } VoucherTypes result = GLHelper.RegisterVoucherType(vouhertype); if (result != null) { return(Ok(new APIResponse() { status = APIStatus.PASS.ToString(), response = result })); } return(Ok(new APIResponse() { status = APIStatus.FAIL.ToString(), response = "Registration failed." })); } catch (Exception ex) { return(Ok(new APIResponse() { status = APIStatus.FAIL.ToString(), response = ex.Message })); } }
public VoucherReportWindow(VoucherTypes voucherType, int voucherNumber) { InitializeComponent(); _viewModel = new VoucherReportViewModel(); _viewModel.Initialize(); _viewModel.VoucherNumber = voucherNumber; _viewModel.VoucherType = voucherType; DataContext = _viewModel; if (voucherType == VoucherTypes.OR) { AttachmentReportButton.Visibility = Visibility.Collapsed; CollectorPanel.Visibility = Visibility.Visible; CollectorDetailedReportButton.Click += (sender, e) => GenerateCollectorDetailedReport(); CollectorSummaryReportButton.Click += (sender, e) => GenerateCollectorSummaryReport(); } else { AttachmentReportButton.Visibility = Visibility.Visible; CollectorPanel.Visibility = Visibility.Collapsed; } }
public VoucherDocument(VoucherTypes type, int number, DateTime date) { Type = type; Number = number; Date = date; }
public Voucher FindByVoucherType(VoucherTypes vouchertype) { return(db.Vouchers.Where(x => x.VoucherType == vouchertype).FirstOrDefault()); }