예제 #1
0
        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
                }));
            }
        }
예제 #2
0
        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; }
        }
예제 #3
0
        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
                }));
            }
        }
예제 #4
0
        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
        }
예제 #5
0
        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);
        }
예제 #6
0
        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]));
        }
예제 #7
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);
        }
예제 #8
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"]));
        }
예제 #9
0
        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; }
        }
예제 #10
0
        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);
        }
예제 #11
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);
        }
예제 #12
0
        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
                }));
            }
        }
예제 #13
0
        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;
            }
        }
예제 #14
0
 public VoucherDocument(VoucherTypes type, int number, DateTime date)
 {
     Type   = type;
     Number = number;
     Date   = date;
 }
예제 #15
0
 public Voucher FindByVoucherType(VoucherTypes vouchertype)
 {
     return(db.Vouchers.Where(x => x.VoucherType == vouchertype).FirstOrDefault());
 }