public JsonResult Ajax_Create(Guid?UserAccounts_Id, string Description, DateTime Timestamp, int Amount)
        {
            if (UserAccounts_Id == null)
            {
                UtilWebMVC.Json(Response, "Please select employee");
            }
            else if (string.IsNullOrEmpty(Description))
            {
                UtilWebMVC.Json(Response, "Please provide description");
            }
            else
            {
                Guid Id = Guid.NewGuid();
                add(new PayrollPaymentItemsModel()
                {
                    Id = Id,
                    PayrollPayments_Id = null,
                    Timestamp          = Timestamp,
                    Description        = Description,
                    Hour            = 0,
                    HourlyRate      = 0,
                    TutorTravelCost = 0,
                    Amount          = Amount,
                    UserAccounts_Id = UserAccounts_Id.Value,
                    CancelNotes     = string.Empty,
                    Branches_Id     = Helper.getActiveBranchId(Session),
                    IsFullTime      = false
                });

                ActivityLogsController.AddCreateLog(db, Session, Id);
                db.SaveChanges();
            }

            return(Json(new { Message = "" }));
        }
Exemplo n.º 2
0
        public ActionResult Edit(HourlyRatesModel modifiedModel, string FILTER_Keyword)
        {
            if (ModelState.IsValid)
            {
                if (isExists(modifiedModel.Id, modifiedModel))
                {
                    UtilWebMVC.setBootboxMessage(this, "Kombinasi sudah terdaftar");
                }
                else
                {
                    HourlyRatesModel originalModel = get(modifiedModel.Id);

                    string log = string.Empty;
                    log = Helper.append <BranchesModel>(log, originalModel.Branches_Id, modifiedModel.Branches_Id, HourlyRatesModel.COL_Branches_Id.LogDisplay);
                    log = Helper.append <LessonPackagesModel>(log, originalModel.LessonPackages_Id, modifiedModel.LessonPackages_Id, HourlyRatesModel.COL_LessonPackages_Id.LogDisplay);
                    log = Helper.append <UserAccountsModel>(log, originalModel.UserAccounts_Id, modifiedModel.UserAccounts_Id, HourlyRatesModel.COL_UserAccounts_Id.LogDisplay);
                    log = Helper.append(log, originalModel.Rate, modifiedModel.Rate, HourlyRatesModel.COL_Rate.LogDisplay);
                    log = Helper.append(log, originalModel.FullTimeTutorPayrate, modifiedModel.FullTimeTutorPayrate, HourlyRatesModel.COL_FullTimeTutorPayrate.LogDisplay);
                    log = Helper.append(log, originalModel.Notes, modifiedModel.Notes, HourlyRatesModel.COL_Notes.LogDisplay);

                    if (!string.IsNullOrEmpty(log))
                    {
                        update(modifiedModel, log);
                    }

                    return(RedirectToAction(nameof(Index), new { FILTER_Keyword = FILTER_Keyword }));
                }
            }

            setViewBag(FILTER_Keyword);
            return(View(modifiedModel));
        }
Exemplo n.º 3
0
        /* INDEX **********************************************************************************************************************************************/

        // GET: UserAccounts
        public ActionResult Index(int?rss, string FILTER_Keyword, int?FILTER_Active, Guid?FILTER_Languages_Id)
        {
            if (!UserAccountsController.getUserAccess(Session).UserAccounts_View)
            {
                return(RedirectToAction(nameof(HomeController.Index), "Home"));
            }

            setViewBag(FILTER_Keyword, FILTER_Active, FILTER_Languages_Id);
            if (rss != null)
            {
                ViewBag.RemoveDatatablesStateSave = rss;
                return(View());
            }
            else
            {
                if (UtilWebMVC.hasNoFilter(FILTER_Keyword, FILTER_Active, FILTER_Languages_Id))
                {
                    return(View());
                }
                else
                {
                    string roles = "";
                    if (!getUserAccess(Session).UserAccounts_EditRoles)
                    {
                        roles = SettingsController.get().StudentRole.ToString();
                    }
                    return(View(get(null, null, FILTER_Keyword, FILTER_Active, FILTER_Languages_Id, roles, false)));
                }
            }
        }
Exemplo n.º 4
0
        /* INDEX **********************************************************************************************************************************************/

        // GET: LessonSessions
        public ActionResult Index(int?rss, string FILTER_Keyword, string FILTER_InvoiceNo, int?FILTER_Cancelled,
                                  bool?FILTER_chkDateFrom, DateTime?FILTER_DateFrom, bool?FILTER_chkDateTo, DateTime?FILTER_DateTo)
        {
            if (!UserAccountsController.getUserAccess(Session).LessonSessions_View)
            {
                return(RedirectToAction(nameof(HomeController.Index), "Home"));
            }

            if (UtilWebMVC.hasNoFilter(FILTER_Keyword, FILTER_InvoiceNo, FILTER_Cancelled, FILTER_chkDateFrom, FILTER_DateFrom, FILTER_chkDateTo, FILTER_DateTo))
            {
                FILTER_chkDateFrom = true;
                FILTER_DateFrom    = Helper.getCurrentDateTime();
                if (UserAccountsController.getUserAccount(Session).Roles_List.Contains(SettingsController.get().StudentRole.ToString()))
                {
                    FILTER_Cancelled = 0;
                }
            }

            setViewBag(FILTER_Keyword, FILTER_InvoiceNo, FILTER_Cancelled, FILTER_chkDateFrom, FILTER_DateFrom, FILTER_chkDateTo, FILTER_DateTo);
            if (rss != null)
            {
                ViewBag.RemoveDatatablesStateSave = rss;
                return(View());
            }
            else
            {
                List <LessonSessionsModel> models = get(FILTER_Keyword, FILTER_InvoiceNo, FILTER_Cancelled, FILTER_chkDateFrom, FILTER_DateFrom, FILTER_chkDateTo, FILTER_DateTo)
                                                    .OrderByDescending(x => x.Timestamp).ToList();
                return(View(models));
            }
        }
Exemplo n.º 5
0
        public ActionResult Edit(SettingsModel modifiedModel, List <HttpPostedFileBase> uploadFiles)
        {
            if (!UserAccountsController.getUserAccess(Session).Settings_Edit)
            {
                return(RedirectToAction(nameof(HomeController.Index), "Home"));
            }

            if (ModelState.IsValid)
            {
                //Prepare changes
                SettingsModel originalModel = get();
                string        log           = string.Empty;

                log = addLog(log, SettingsModel.COL_AutoEntryForCashPayments.Id, SettingsModel.COL_AutoEntryForCashPayments.Display,
                             db.PettyCashRecordsCategories.Where(x => x.Id == originalModel.AutoEntryForCashPayments).FirstOrDefault().Name,
                             db.PettyCashRecordsCategories.Where(x => x.Id == modifiedModel.AutoEntryForCashPayments).FirstOrDefault().Name,
                             "Update: '{1}'");
                log = addLog(log, SettingsModel.COL_AutoEntryForCashPayments.Id, SettingsModel.COL_AutoEntryForCashPayments.Display, originalModel.AutoEntryForCashPayments_Notes, modifiedModel.AutoEntryForCashPayments_Notes, "Notes: '{1}'");

                log = addLog(log, SettingsModel.COL_StudentRole.Id, SettingsModel.COL_StudentRole.Display,
                             originalModel.StudentRole == null ? "" : db.UserAccountRoles.Where(x => x.Id == originalModel.StudentRole).FirstOrDefault().Name,
                             modifiedModel.StudentRole == null ? "" : db.UserAccountRoles.Where(x => x.Id == modifiedModel.StudentRole).FirstOrDefault().Name,
                             "Update: '{1}'");
                log = addLog(log, SettingsModel.COL_StudentRole.Id, SettingsModel.COL_StudentRole.Display, originalModel.StudentRole_Notes, modifiedModel.StudentRole_Notes, "Notes: '{1}'");

                log = addLog(log, SettingsModel.COL_TutorRole.Id, SettingsModel.COL_TutorRole.Display,
                             originalModel.TutorRole == null ? "" : db.UserAccountRoles.Where(x => x.Id == originalModel.TutorRole).FirstOrDefault().Name,
                             modifiedModel.TutorRole == null ? "" : db.UserAccountRoles.Where(x => x.Id == modifiedModel.TutorRole).FirstOrDefault().Name,
                             "Update: '{1}'");
                log = addLog(log, SettingsModel.COL_TutorRole.Id, SettingsModel.COL_TutorRole.Display, originalModel.TutorRole_Notes, modifiedModel.TutorRole_Notes, "Notes: '{1}'");

                log = addLog(log, SettingsModel.COL_ResetPassword.Id, SettingsModel.COL_ResetPassword.Display, originalModel.ResetPassword, modifiedModel.ResetPassword, "UPDATE: '{1}'");
                log = addLog(log, SettingsModel.COL_ResetPassword.Id, SettingsModel.COL_ResetPassword.Display, originalModel.ResetPassword_Notes, modifiedModel.ResetPassword_Notes, "Notes: '{1}'");

                log = addLogForList <UserAccountRolesModel>(log, SettingsModel.COL_FullAccessForTutorSchedules.Id, SettingsModel.COL_FullAccessForTutorSchedules.Display, originalModel.FullAccessForTutorSchedules_List, modifiedModel.FullAccessForTutorSchedules_List);
                log = addLog(log, SettingsModel.COL_FullAccessForTutorSchedules.Id, SettingsModel.COL_FullAccessForTutorSchedules.Display, originalModel.FullAccessForTutorSchedules_Notes, modifiedModel.FullAccessForTutorSchedules_Notes, "Notes: '{1}'");

                log = addLogForList <UserAccountRolesModel>(log, SettingsModel.COL_ShowOnlyOwnUserData.Id, SettingsModel.COL_ShowOnlyOwnUserData.Display, originalModel.ShowOnlyOwnUserData_List, modifiedModel.ShowOnlyOwnUserData_List);
                log = addLog(log, SettingsModel.COL_ShowOnlyOwnUserData.Id, SettingsModel.COL_ShowOnlyOwnUserData.Display, originalModel.ShowOnlyOwnUserData_Notes, modifiedModel.ShowOnlyOwnUserData_Notes, "Notes: '{1}'");

                log = addLogForList <UserAccountRolesModel>(log, SettingsModel.COL_PayrollRatesRoles.Id, SettingsModel.COL_PayrollRatesRoles.Display, originalModel.PayrollRatesRoles_List, modifiedModel.PayrollRatesRoles_List);
                log = addLog(log, SettingsModel.COL_PayrollRatesRoles.Id, SettingsModel.COL_PayrollRatesRoles.Display, originalModel.PayrollRatesRoles_Notes, modifiedModel.PayrollRatesRoles_Notes, "Notes: '{1}'");

                //Update Database
                if (string.IsNullOrEmpty(log))
                {
                    UtilWebMVC.setBootboxMessage(this, "No change to update");
                }
                else
                {
                    update(modifiedModel); //update setting values
                    db.SaveChanges();      //insert activity logs
                    UtilWebMVC.setBootboxMessage(this, log);
                    return(RedirectToAction(nameof(Edit)));
                }
            }

            setViewBag(modifiedModel);
            return(View(modifiedModel));
        }
Exemplo n.º 6
0
        /* INDEX **********************************************************************************************************************************************/

        // GET: SaleInvoices
        public ActionResult Index(int?rss, string FILTER_Keyword, string FILTER_PaymentNo, int?FILTER_Cancelled, int?FILTER_Approved, int?FILTER_HasDueAmount,
                                  bool?FILTER_chkDateFrom, DateTime?FILTER_DateFrom, bool?FILTER_chkDateTo, DateTime?FILTER_DateTo)
        {
            if (!UserAccountsController.getUserAccess(Session).SaleInvoices_View)
            {
                return(RedirectToAction(nameof(HomeController.Index), "Home"));
            }

            if (UtilWebMVC.hasNoFilter(FILTER_Keyword, FILTER_PaymentNo, FILTER_Cancelled, FILTER_Approved, FILTER_chkDateFrom, FILTER_DateFrom, FILTER_chkDateTo, FILTER_DateTo))
            {
                //FILTER_chkDateFrom = true;
                //FILTER_DateFrom = Helper.getCurrentDateTime();
                FILTER_Cancelled = 0;
                if (UserAccountsController.getUserAccount(Session).Roles_List.Contains(SettingsController.get().StudentRole.ToString()))
                {
                    FILTER_HasDueAmount = null;
                }
                else
                {
                    FILTER_HasDueAmount = 1;
                }
            }

            setViewBag(FILTER_Keyword, FILTER_PaymentNo, FILTER_Cancelled, FILTER_Approved, FILTER_HasDueAmount, FILTER_chkDateFrom, FILTER_DateFrom, FILTER_chkDateTo, FILTER_DateTo);
            ViewBag.RemoveDatatablesStateSave = rss;

            List <SaleInvoicesModel> models = get(FILTER_Keyword, FILTER_PaymentNo, FILTER_Cancelled, FILTER_Approved, FILTER_HasDueAmount, FILTER_chkDateFrom, FILTER_DateFrom, FILTER_chkDateTo, FILTER_DateTo)
                                              .OrderByDescending(x => x.No).ToList();

            return(View(models));
        }
Exemplo n.º 7
0
        public ActionResult returnView(List <LessonSessionsModel> LessonSessions, string errorMessage)
        {
            if (!string.IsNullOrEmpty(errorMessage))
            {
                UtilWebMVC.setBootboxMessage(this, errorMessage);
            }

            ViewData["LessonSessions"] = LessonSessions;
            return(View());
        }
Exemplo n.º 8
0
        public ActionResult Create(SaleInvoicesModel model, string JsonSaleInvoiceItems,
                                   string FILTER_Keyword, string FILTER_PaymentNo, int?FILTER_Cancelled, int?FILTER_Approved, int?FILTER_HasDueAmount,
                                   bool?FILTER_chkDateFrom, DateTime?FILTER_DateFrom, bool?FILTER_chkDateTo, DateTime?FILTER_DateTo)
        {
            List <SaleInvoiceItemsModel> SaleInvoiceItems = new List <SaleInvoiceItemsModel>();

            if (!string.IsNullOrEmpty(JsonSaleInvoiceItems))
            {
                SaleInvoiceItems = JsonConvert.DeserializeObject <List <SaleInvoiceItemsModel> >(JsonSaleInvoiceItems);
            }

            string errorMessage = "";

            if (ModelState.IsValid)
            {
                if (SaleInvoiceItems.Count == 0)
                {
                    UtilWebMVC.setBootboxMessage(this, "Please add at least 1 item");
                }
                else if (!hasSufficientInventory(SaleInvoiceItems, out errorMessage))
                {
                    UtilWebMVC.setBootboxMessage(this, errorMessage);
                }
                else
                {
                    add(model, SaleInvoiceItems);
                    return(RedirectToAction(nameof(Index), new { rss = 1 }));

                    //not working. all filter returns null
                    //return RedirectToAction(nameof(Index), new
                    //{
                    //    FILTER_Keyword = FILTER_Keyword,
                    //    FILTER_PaymentNo = FILTER_PaymentNo,
                    //    FILTER_Cancelled = FILTER_Cancelled,
                    //    FILTER_Approved = FILTER_Approved,
                    //    FILTER_chkDateFrom = FILTER_chkDateFrom,
                    //    FILTER_DateFrom = FILTER_DateFrom,
                    //    FILTER_chkDateTo = FILTER_chkDateTo,
                    //    FILTER_DateTo = FILTER_DateTo
                    //});
                }
            }

            setViewBag(FILTER_Keyword, FILTER_PaymentNo, FILTER_Cancelled, FILTER_Approved, FILTER_HasDueAmount, FILTER_chkDateFrom, FILTER_DateFrom, FILTER_chkDateTo, FILTER_DateTo);
            ViewData["SaleInvoiceItems"] = SaleInvoiceItems;
            return(View(model));
        }
Exemplo n.º 9
0
        public ActionResult Create(HourlyRatesModel model, string FILTER_Keyword)
        {
            if (ModelState.IsValid)
            {
                if (isExists(null, model))
                {
                    UtilWebMVC.setBootboxMessage(this, "Kombinasi sudah terdaftar");
                }
                else
                {
                    add(model);
                    return(RedirectToAction(nameof(Index), new { FILTER_Keyword = FILTER_Keyword }));
                }
            }

            setViewBag(FILTER_Keyword);
            return(View(model));
        }
Exemplo n.º 10
0
        public JsonResult Ajax_Create(Guid UserAccounts_Id, string Notes, DateTime Timestamp, decimal Amount, DateTime DatePeriod)
        {
            List <PayrollPaymentItemsModel> PayrollPaymentItems = PayrollPaymentItemsController.combineClassSesions(PayrollPaymentItemsController.get(Session, UserAccounts_Id, DatePeriod, null));

            if (Amount != PayrollPaymentItems.Sum(x => x.Amount - x.PayrollPaymentAmount))
            {
                return(UtilWebMVC.Json(Response, "Due amount has changed. Please reload list and try again."));
            }

            add(PayrollPaymentItems, new PayrollPaymentsModel
            {
                Id              = Guid.NewGuid(),
                Timestamp       = Timestamp,
                Amount          = Amount,
                Notes           = Notes,
                UserAccounts_Id = UserAccounts_Id,
                Branches_Id     = (Guid)PayrollPaymentItems[0].Branches_Id
            });

            return(Json(new { Message = "" }));
        }
Exemplo n.º 11
0
        public static DateTime setFilterViewBag(Controller controller, int?year, int?month, DateTime?PayPeriod, string search, string periodChange, int?ActionType)
        {
            DateTime payPeriod;

            if (PayPeriod != null)
            {
                payPeriod = (DateTime)PayPeriod;
            }
            else if (month == null || year == null)
            {
                payPeriod = new DateTime(getCurrentDateTime().Year, getCurrentDateTime().Month, 1, 0, 0, 0);
            }
            else
            {
                payPeriod = new DateTime((int)year, (int)month, 1, 0, 0, 0);
            }

            if (periodChange == EnumActions.Previous.ToString())
            {
                payPeriod = payPeriod.AddMonths(-1);
            }
            else if (periodChange == EnumActions.Next.ToString())
            {
                payPeriod = payPeriod.AddMonths(1);
            }

            var ViewBag = controller.ViewBag;

            ViewBag.PayPeriodYear  = UtilWebMVC.validateParameter(payPeriod.Year);
            ViewBag.PayPeriodMonth = UtilWebMVC.validateParameter(payPeriod.Month);
            ViewBag.PayPeriod      = UtilWebMVC.validateParameter(payPeriod);
            ViewBag.Search         = UtilWebMVC.validateParameter(search);
            ViewBag.ActionType     = UtilWebMVC.validateParameter(ActionType);

            return(payPeriod);
        }
Exemplo n.º 12
0
        public ActionResult Create(string submitButton, Guid?ParentId, HttpPostedFileBase File, Guid?FileId, string FileDescription, bool?IsGlobalFile, Guid?DirectoryId, string DirectoryName, bool?IsGlobalDirectory)
        {
            FilesModel model = new FilesModel();

            if (ParentId == null)
            {
                model.ParentId = RootId;
            }
            else
            {
                model.ParentId = (Guid)ParentId;
            }

            if (IsGlobalFile == true || IsGlobalDirectory == true)
            {
                model.Branches_Id = null;
            }
            else
            {
                model.Branches_Id = Helper.getActiveBranchId(Session);
            }

            if (submitButton == BUTTONVALUE_UPLOADFILE || submitButton == BUTTONVALUE_UPLOADREVISION)
            {
                if (File == null || File.ContentLength == 0)
                {
                    UtilWebMVC.setBootboxMessage(this, "Invalid File");
                }
                else
                {
                    AuthorizationCodeWebApp.AuthResult authorization = GoogleDriveAPIHelper.getAuthorization(this);
                    if (authorization.Credential == null)
                    {
                        UtilWebMVC.setBootboxMessage(this, "Google Login was required. Please navigate to the folder and try to upload the file again.");
                        return(RedirectToAction(nameof(IndexAsync)));
                    }
                    else
                    {
                        authorization = GoogleDriveAPIHelper.checkExpiration(this, authorization);

                        string OnlineFileId = GoogleDriveAPIHelper.UploadToDrive(GoogleDriveAPIHelper.GetServiceForWebApplication(authorization), File);
                        if (GoogleDriveAPIHelper.isFileUploadSuccessful(this, OnlineFileId))
                        {
                            model.Filename     = File.FileName;
                            model.OnlineFileId = OnlineFileId;
                            model.Notes        = FileDescription;

                            if (submitButton == BUTTONVALUE_UPLOADFILE)
                            {
                                add(model);
                            }
                            else
                            {
                                FilesModel originalModel = get((Guid)FileId);
                                model.ParentId = originalModel.ParentId;
                                add(model);
                                originalModel.ParentId = model.Id;
                                update(originalModel);
                            }
                        }
                    }
                }
            }
            else if (submitButton == BUTTONVALUE_CREATEDIRECTORY || submitButton == BUTTONVALUE_UPDATEDIRECTORY)
            {
                if (string.IsNullOrWhiteSpace(DirectoryName))
                {
                    UtilWebMVC.setBootboxMessage(this, "Invalid Name");
                }
                else
                {
                    model.DirectoryName = DirectoryName;
                    if (submitButton == BUTTONVALUE_CREATEDIRECTORY)
                    {
                        add(model);
                    }
                    else
                    {
                        model.Id = (Guid)DirectoryId;
                        update(model);
                    }
                }
            }

            return(null);
        }
Exemplo n.º 13
0
        public static List <SaleInvoicesModel> get(HttpSessionStateBase Session, Guid?Id, string SaleInvoiceItemIdList,
                                                   string FILTER_Keyword, string FILTER_PaymentNo, bool?FILTER_chkDateFrom, DateTime?FILTER_DateFrom, bool?FILTER_chkDateTo, DateTime?FILTER_DateTo,
                                                   int?Cancelled, int?Approved, int?FILTER_HasDueAmount)
        {
            Guid Branches_Id = Helper.getActiveBranchId(Session);

            if (FILTER_chkDateFrom == null || !(bool)FILTER_chkDateFrom)
            {
                FILTER_DateFrom = null;
            }

            if (FILTER_chkDateTo == null || !(bool)FILTER_chkDateTo)
            {
                FILTER_DateTo = null;
            }

            string SaleInvoiceItemIdListClause = "";

            if (!string.IsNullOrEmpty(SaleInvoiceItemIdList))
            {
                SaleInvoiceItemIdListClause = string.Format("AND SaleInvoices.Id IN ({0})", UtilWebMVC.convertToSqlIdList(SaleInvoiceItemIdList));
            }

            string ShowOnlyOwnUserDataClause = "";

            if (UserAccountsController.getShowOnlyUserData(Session))
            {
                ShowOnlyOwnUserDataClause = string.Format(" AND Customer_UserAccounts.Id = '{0}' ", UserAccountsController.getUserId(Session));
            }

            string sql = string.Format(@"
                    SELECT SaleInvoices.*,
                        Branches.Name AS Branches_Name,
                        Customer_UserAccounts.Fullname AS Customer_UserAccounts_Name,
                        Customer_UserAccounts.No AS Customer_UserAccounts_No,
                        ROW_NUMBER() OVER (ORDER BY SaleInvoices.No DESC) AS InitialRowNumber
                    FROM SaleInvoices
                        LEFT JOIN Branches ON Branches.Id = SaleInvoices.Branches_Id
                        LEFT JOIN UserAccounts Customer_UserAccounts ON Customer_UserAccounts.Id = SaleInvoices.Customer_UserAccounts_Id
                    WHERE 1=1
						AND (@Id IS NULL OR SaleInvoices.Id = @Id)
						AND (@Id IS NOT NULL OR (
                            (@FILTER_Keyword IS NULL OR (
                                    SaleInvoices.No LIKE '%'+@FILTER_Keyword+'%'
                                    OR Customer_UserAccounts.Fullname LIKE '%'+@FILTER_Keyword+'%'
                                ))
                            AND (@FILTER_PaymentNo IS NULL OR (SaleInvoices.Id IN (                                
                                SELECT SaleInvoices.Id
                                FROM PaymentItems 
	                                LEFT JOIN Payments ON Payments.Id = PaymentItems.Payments_Id
	                                LEFT JOIN SaleInvoices ON Saleinvoices.Id = PaymentItems.ReferenceId
                                WHERE Payments.No = @FILTER_PaymentNo
                            )))
                            AND (@FILTER_DateFrom IS NULL OR SaleInvoices.Timestamp >= @FILTER_DateFrom)
                            AND (@FILTER_DateTo IS NULL OR SaleInvoices.Timestamp <= @FILTER_DateTo)
                            AND (@Cancelled IS NULL OR SaleInvoices.Cancelled = @Cancelled)
                            AND (@Approved IS NULL OR SaleInvoices.Approved = @Approved)
                            AND (@FILTER_HasDueAmount IS NULL OR ((@FILTER_HasDueAmount = 0 AND SaleInvoices.Due = 0) OR (@FILTER_HasDueAmount = 1 AND SaleInvoices.Due > 0)))
                            AND (@Branches_Id IS NULL OR SaleInvoices.Branches_Id = @Branches_Id)
                            {0}{1}
                        ))
					ORDER BY SaleInvoices.No DESC
                ", SaleInvoiceItemIdListClause, ShowOnlyOwnUserDataClause);

            return(new DBContext().Database.SqlQuery <SaleInvoicesModel>(sql,
                                                                         DBConnection.getSqlParameter(SaleInvoicesModel.COL_Id.Name, Id),
                                                                         DBConnection.getSqlParameter("FILTER_Keyword", FILTER_Keyword),
                                                                         DBConnection.getSqlParameter("FILTER_PaymentNo", FILTER_PaymentNo),
                                                                         DBConnection.getSqlParameter("FILTER_DateFrom", FILTER_DateFrom),
                                                                         DBConnection.getSqlParameter("FILTER_DateTo", Util.getAsEndDate(FILTER_DateTo)),
                                                                         DBConnection.getSqlParameter("FILTER_HasDueAmount", FILTER_HasDueAmount),
                                                                         DBConnection.getSqlParameter(SaleInvoicesModel.COL_Branches_Id.Name, Branches_Id),
                                                                         DBConnection.getSqlParameter(SaleInvoicesModel.COL_Cancelled.Name, Cancelled),
                                                                         DBConnection.getSqlParameter(SaleInvoicesModel.COL_Approved.Name, Approved)
                                                                         ).ToList());
        }
Exemplo n.º 14
0
 public JsonResult Ajax_Update_CancelNotes(Guid id, string notes)
 {
     return(UtilWebMVC.Json(Response, update_CancelNotes(id, notes)));
 }