Example #1
0
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            try
            {
                //insert data to database
                ResponseQuery = DbTransaction.DbToString("dbo.sp_SubmitInvoice", new
                {
                    @InvoiceNumber = txtInvoiceNumber.Text,
                    Userlogin      = UserProfile.Username
                }, true);

                //show notification
                if (ResponseQuery.Contains("Success"))
                {
                    alert.MessageString(Alert.SUCCESS, "Submit Invoice Item", ResponseQuery, this.Page, GetType());
                    hfStatus.Value = "Submit";
                    SetDataOnoad(txtInvoiceNumber.Text);
                }
                else
                {
                    alert.MessageString(Alert.WARNING, "Submit Invoice Item", ResponseQuery, this.Page, GetType());
                }
            }
            catch (Exception ex)
            {
                alert.MessageString(Alert.ERROR, ex.Message, Page, GetType());
            }
        }
Example #2
0
        protected void gridInvoiceItem_RowDeleting(object sender, DevExpress.Web.Data.ASPxDataDeletingEventArgs e)
        {
            try
            {
                int key = Convert.ToInt16(e.Keys[0]);
                BootstrapPopupControl popup = popupAddLO;
                BootstrapGridView     grid  = (BootstrapGridView)popup.FindControl("gridAddLO");

                //execute data to database
                ResponseQuery = DbTransaction.DbToString("dbo.sp_DeleteInvoice_Item", new
                {
                    InvoiceNumber = txtInvoiceNumber.Text,
                    LO_ID         = key,
                    userlogin     = UserProfile.Username
                }, true);

                //set gridview invoice item
                e.Cancel = true;
                gridInvoiceItem.DataBind();

                //show notification
                gridInvoiceItem.JSProperties["cpRes"] = ResponseQuery;
            }
            catch (Exception ex)
            {
                gridInvoiceItem.JSProperties["cpRes"] = ex.Message;
            }
        }
Example #3
0
        protected void gvMasterDataUser_RowDeleting(object sender, DevExpress.Web.Data.ASPxDataDeletingEventArgs e)
        {
            string response = string.Empty;

            try
            {
                response = DbTransaction.DbToString("dbo.sp_DeleteMasterDataUser", new
                {
                    userid    = e.Keys[0],
                    userlogin = UserProfile.Username
                }, true);
            }
            catch (Exception ex)
            {
                response = ex.Message;
            }
            finally
            {
                gvMasterDataUser.JSProperties["cpRes"] = response;
                e.Cancel = true;
                if (response.Contains("Success"))
                {
                    gvMasterDataUser.CancelEdit();
                }
            }
        }
Example #4
0
        protected void gridSPPB_RowDeleting(object sender, DevExpress.Web.Data.ASPxDataDeletingEventArgs e)
        {
            int SPP_ID = Convert.ToInt32(e.Keys[0]);

            try
            {
                response = DbTransaction.DbToString(QueryDeleteSPP, new { SPP_ID = SPP_ID, userlogin = UserProfile.Username }, true);

                e.Cancel = true;
                gridSPPB.DataBind();

                if (response.Contains("Success"))
                {
                    alert.MessageString(Alert.SUCCESS, "Delete SPPB", response, this.Page, GetType());
                }
                else
                {
                    alert.MessageString(Alert.WARNING, "Delete SPPB", response, this.Page, GetType());
                }
            }
            catch (Exception ex)
            {
                alert.MessageString(Alert.ERROR, "Delete SPPB", ex.Message, this.Page, GetType());
            }
        }
Example #5
0
        protected void gvProductSP3M_RowDeleting(object sender, DevExpress.Web.Data.ASPxDataDeletingEventArgs e)
        {
            //ListProductSP3M.Remove(ListProductSP3M.FirstOrDefault(x => x.ProductID == e.Keys[0].ToString()));
            //e.Cancel = true;

            string Response = string.Empty;

            try
            {
                int SP3MItem_ID = Convert.ToInt16(e.Keys[0]);
                Response = DbTransaction.DbToString("dbo.sp_DeleteSP3M_Item", new { SP3M_Items_ID = SP3MItem_ID, userlogin = UserProfile.Username }, true);

                e.Cancel = true;
                gvProductSP3M.CancelEdit();

                if (Response.Contains("Success"))
                {
                    alert.MessageString(Alert.SUCCESS, "Delete Product", Response, this.Page, GetType());
                }
                else
                {
                    alert.MessageString(Alert.WARNING, "Delete Product", Response, this.Page, GetType());
                }
            }
            catch (Exception ex)
            {
                alert.MessageString(Alert.ERROR, "Delete Product", ex.Message, this.Page, GetType());
            }
        }
Example #6
0
        protected void gridListInvoice_CustomCallback(object sender, DevExpress.Web.ASPxGridViewCustomCallbackEventArgs e)
        {
            if (e.Parameters != null)
            {
                string[] arrParam = e.Parameters.Split('|');
                if (arrParam[0] == "Process")
                {
                    //set value
                    string key           = arrParam[1];
                    object rownumber     = gridListInvoice.GetSelectedFieldValues("Invoice_ID");
                    string invoicenumber = gridListInvoice.GetRowValuesByKeyValue(key, "InvoiceNumber").ToString();

                    //execute data to database
                    ResponseQuery = DbTransaction.DbToString("dbo.sp_SubmitInvoicePertamina", new
                    {
                        Invoice_ID = key,
                        Invoice_No = invoicenumber,
                        userlogin  = UserProfile.Username
                    }, true);

                    //show notification
                    gridListInvoice.JSProperties["cpRes"] = ResponseQuery;
                }
            }
        }
Example #7
0
        protected void gridInvoiceItem_RowUpdating(object sender, DevExpress.Web.Data.ASPxDataUpdatingEventArgs e)
        {
            try
            {
                //update list
                int LoID     = Convert.ToInt16(e.Keys[0]);
                int ProdukID = Convert.ToInt16(e.Keys[1]);
                ResponseQuery = DbTransaction.DbToString("dbo.sp_EditInvoice_Items", new
                {
                    InvoiceNumber  = txtInvoiceNumber.Text,
                    @Lo_ID_FK      = LoID,
                    @Product_ID_FK = ProdukID,
                    @Price         = Convert.ToInt32(e.NewValues["PriceUnit"]),
                    Userlogin      = UserProfile.Username
                }, true);

                //set gridview invoice item
                e.Cancel = true;
                //gridInvoiceItem.DataBind();
                gridInvoiceItem.CancelEdit();

                //show notification
                gridInvoiceItem.JSProperties["cpRes"] = ResponseQuery;
            }
            catch (Exception ex)
            {
                gridInvoiceItem.JSProperties["cpRes"] = ex.Message;
            }
        }
Example #8
0
        protected void gridListInvoice_RowDeleting(object sender, DevExpress.Web.Data.ASPxDataDeletingEventArgs e)
        {
            //set invoice id
            int Invoice_ID = Convert.ToInt32(e.Keys[0]);

            try
            {
                //delete invoice
                ResponseQuery = DbTransaction.DbToString("dbo.sp_DeleteInvoice", new { Invoice_ID = Invoice_ID, userlogin = UserProfile.Username }, true);

                //refresh gridview
                e.Cancel = true;
                gridListInvoice.DataBind();

                //show message
                if (ResponseQuery.Contains("Success"))
                {
                    alert.MessageString(Alert.SUCCESS, "Delete Invoice", ResponseQuery, this.Page, GetType());
                }
                else
                {
                    alert.MessageString(Alert.WARNING, "Delete Invoice", ResponseQuery, this.Page, GetType());
                }
            }
            catch (Exception ex)
            {
                alert.MessageString(Alert.ERROR, "Delete Invoice", ex.Message, this.Page, GetType());
            }
        }
Example #9
0
        protected void btnReject_Click(object sender, EventArgs e)
        {
            string Response = string.Empty;

            try
            {
                //set sp3m id
                //set variable from query string
                SP3M_ID = string.IsNullOrEmpty((string)Request.QueryString["SP3M_ID"]) ? 0 : Convert.ToInt16(Request.QueryString["SP3M_ID"]);

                Response = DbTransaction.DbToString("dbo.sp_RejectSP3M", new
                {
                    SP3M_ID   = SP3M_ID,
                    nosp3m    = txtSP3M_Number.Text.Trim(),
                    userlogin = UserProfile.Username
                }, true);

                if (Response.Contains("Success"))
                {
                    alert.MessageString(Alert.SUCCESS, "Reject SP3M", Response, this.Page, GetType());
                    SetEnabled(false);
                    SetEnabledButton(UserProfile.Roles, StatusSP3M);
                }
                else
                {
                    alert.MessageString(Alert.WARNING, "Reject SP3M", Response, this.Page, GetType());
                }
            }
            catch (Exception ex)
            {
                alert.MessageString(Alert.ERROR, "Reject SP3M", ex.Message, this.Page, GetType());
            }
        }
Example #10
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                //initialize invoice item
                string InvoiceItem = string.Empty;
                ListInvoiceItem = GetDatainvoiceItem(txtInvoiceNumber.Text ?? string.Empty);

                //warning if invoice item is empty
                if (ListInvoiceItem.Count == 0)
                {
                    alert.MessageString(Alert.WARNING, "Simpan Invoice", "Data Invoice Item belum diinput", this.Page, GetType());
                    return;
                }

                //get data invoice item
                foreach (InvoiceModel.InvoiceItem item in ListInvoiceItem)
                {
                    InvoiceItem += string.Format("{0}|", item.LO_ID);
                }

                //set product item
                if (!string.IsNullOrEmpty(InvoiceItem))
                {
                    InvoiceItem = InvoiceItem.Remove(InvoiceItem.Length - 1);
                }

                //insert data to database
                ResponseQuery = DbTransaction.DbToString("dbo.sp_AddInvoice", new
                {
                    Type            = hfInvoiceType.Value
                    , InvoiceNumber = txtInvoiceNumber.Text
                    , ApproveBy     = txtApproveBy.Text ?? string.Empty
                    , InvoiceDate   = dateInvoice.Date == DateTime.MinValue ? Convert.ToDateTime("1/1/1900") : dateInvoice.Date
                    , Note          = txtNote.Text ?? string.Empty
                    , Status        = 1
                    , Userlogin     = UserProfile.Username
                    , InvoiceItem   = InvoiceItem
                }, true);

                //show notification
                if (ResponseQuery.Contains("Success"))
                {
                    alert.MessageString(Alert.SUCCESS, "Simpan Invoice", ResponseQuery, this.Page, GetType());
                }
                else
                {
                    alert.MessageString(Alert.WARNING, "Simpan Invoice", ResponseQuery, this.Page, GetType());
                }
            }
            catch (Exception ex)
            {
                alert.MessageString(Alert.ERROR, "Simpan Invoice", ex.Message, Page, GetType());
            }
        }
Example #11
0
        public static string DeleteMasterDataDriver(MasterDataModel.MasterDataDriver item)
        {
            string res = DbTransaction.DbToString("sp_DeleteMasterDataDriver",
                                                  new
            {
                Driver_ID = item.Driver_ID,
                UpdateBy  = item.UpdateBy
            }, true);

            return(res);
        }
Example #12
0
        public static string DeleteMasterDataTBBM(MasterDataModel.MasterDataTBBM item)
        {
            string res = DbTransaction.DbToString("sp_DeleteMasterDataTBBM",
                                                  new
            {
                TBBM_ID_PK = item.TBBM_ID_PK,
                UpdateBy   = item.UpdateBy
            }, true);

            return(res);
        }
Example #13
0
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            try
            {
                SPP_ID = string.IsNullOrEmpty((string)Request.QueryString["SPP_ID"]) ? 0 : Convert.ToInt16(Request.QueryString["SPP_ID"]);

                ResponseQuery = DbTransaction.DbToString("dbo.sp_SubmitSPP", new
                {
                    SPP_ID    = SPP_ID,
                    nospp     = txtSPP_Number.Text.Trim(),
                    userlogin = UserProfile.Username
                }, true);

                if (ResponseQuery.Contains("Success"))
                {
                    alert.MessageString(Alert.SUCCESS, "Submit SPP", ResponseQuery, this.Page, GetType());
                    SetEnabled(false);
                    SetEnabledButton(UserProfile.Roles, StatusSPP);

                    //approve when user is internal
                    foreach (MasterDataModel.MasterDataRole role in UserProfile.Roles)
                    {
                        if (role.RoleName == UserProfile.USER_INTERNAL)
                        {
                            ResponseQuery = DbTransaction.DbToString("dbo.sp_ApproveSPP", new
                            {
                                SPP_ID    = SPP_ID,
                                nospp     = txtSPP_Number.Text.Trim(),
                                userlogin = UserProfile.Username
                            }, true);

                            if (ResponseQuery.Contains("Success"))
                            {
                                alert.MessageString(Alert.SUCCESS, "Approve SPP", ResponseQuery, this.Page, GetType());
                                SetEnabled(false);
                                SetEnabledButton(UserProfile.Roles, StatusSPP);
                            }
                            else
                            {
                                alert.MessageString(Alert.WARNING, "Approve SPP", ResponseQuery, this.Page, GetType());
                            }
                        }
                    }
                }
                else
                {
                    alert.MessageString(Alert.WARNING, "Submit SPP", ResponseQuery, this.Page, GetType());
                }
            }
            catch (Exception ex)
            {
                alert.MessageString(Alert.ERROR, "Submit SPPB", ex.Message, this.Page, GetType());
            }
        }
Example #14
0
        public static string DeleteMasterDataSPSH(MasterDataModel.MasterDataSPSH item)
        {
            string res = DbTransaction.DbToString("sp_DeleteMasterDataSPSH",
                                                  new
            {
                SPSH_ID  = item.SPSH_ID,
                UpdateBy = item.UpdateBy
            }, true);

            return(res);
        }
Example #15
0
        public static string DeleteMasterDataVehicle(MasterDataModel.MasterDataKendaraan item)
        {
            string res = DbTransaction.DbToString("sp_DeleteMasterDataVehicle",
                                                  new
            {
                Vehicle_ID = item.Vehicle_ID,
                UpdateBy   = item.UpdateBy
            }, true);

            return(res);
        }
Example #16
0
        protected void gvProductSP3M_RowInserting(object sender, DevExpress.Web.Data.ASPxDataInsertingEventArgs e)
        {
            //validate data sp3m header
            if (!ValidateInsertSP3M(txtSP3M_Number.Text, cmbForce.Text))
            {
                e.Cancel = true;
                alert.MessageString(Alert.WARNING, "Simpan Produk", "Data SP3M belum diinput, harap input data SP3M terlebih dahulu.", this.Page, GetType());
                return;
            }

            try
            {
                //set noSP3M
                if (SP3M_ID == 0)
                {
                    NoSP3M = txtSP3M_Number.Text;
                }

                //insert data product
                string response = DbTransaction.DbToString("sp_AddSP3M_Item", new
                {
                    SP3M_ID        = SP3M_ID,
                    NoSP3M         = NoSP3M,
                    product        = e.NewValues["ProductName"],
                    unitcapacity   = 1,   //only liter
                    quantityvolume = e.NewValues["QuantityVolume"],
                    priceunit      = e.NewValues["PriceUnit"],
                    pricetotal     = e.NewValues["SubTotal"],
                    userlogin      = UserProfile.Username
                }, true);

                //refresh grid
                e.Cancel = true;

                //show notification
                if (response.Contains("Success"))
                {
                    alert.MessageString(Alert.SUCCESS, "Simpan Produk", response, this.Page, GetType());
                    gvProductSP3M.CancelEdit();
                }
                else
                {
                    alert.MessageString(Alert.WARNING, "Simpan Produk", response, this.Page, GetType());
                }
            }
            catch (Exception ex)
            {
                alert.MessageString(Alert.ERROR, ex.Message, this.Page, GetType());
            }
        }
Example #17
0
        public static string AddMasterDataTBBM(MasterDataModel.MasterDataTBBM item)
        {
            string res = DbTransaction.DbToString("sp_AddMasterDataTBBM",
                                                  new
            {
                Region_ID_FK = item.Region_ID_FK,
                Name         = item.Name,
                Address      = item.Address,
                Telp         = item.Telp,
                Email        = item.Email,
                CreationBy   = item.CreationBy
            }, true);

            return(res);
        }
Example #18
0
        public static string EditMasterDataDistance(MasterDataModel.MasterDataDistance item)
        {
            string res = DbTransaction.DbToString("sp_EditMasterDataDistance",
                                                  new
            {
                TBBM_ID     = item.TBBM_ID,
                SPSH_ID     = item.SPSH_ID,
                Distance    = item.Distance,
                NormalRate  = item.NormalRate,
                SpecialRate = item.SpecialRate,
                UpdateBy    = item.UpdateBy
            }, true);

            return(res);
        }
Example #19
0
        public static string EditMasterDataTransporterFee(MasterDataModel.MasterDataTransporterFee item)
        {
            string res = DbTransaction.DbToString("sp_EditMasterDataTransporterFee",
                                                  new
            {
                Transporter_ID          = item.Transporter_ID,
                Region_ID               = item.Region_ID,
                HandlingFee             = item.HandlingFee,
                OATDistanceLimit        = item.OATDistanceLimit,
                OATPriceUnderEqualLimit = item.OATPriceUnderEqualLimit,
                OATPriceAboveLimit      = item.OATPriceAboveLimit,
                UpdateBy = item.UpdateBy
            }, true);

            return(res);
        }
Example #20
0
        public static string AddMasterDataTransporter(MasterDataModel.MasterDataTransporter item)
        {
            string res = DbTransaction.DbToString("sp_AddMasterDataTransporter",
                                                  new
            {
                TransporterName = item.TransporterName,
                Address         = item.Address,
                Phone           = item.Phone,
                Email           = item.Email,
                Contact1        = item.Contact1,
                Contact2        = item.Contact2,
                CreationBy      = item.CreationBy
            }, true);

            return(res);
        }
Example #21
0
        public static string AddMasterDataSPSH(MasterDataModel.MasterDataSPSH item)
        {
            string res = DbTransaction.DbToString("sp_AddMasterDataSPSH",
                                                  new
            {
                NewSPSH_ID = item.NewSPSH_ID,
                Region_ID  = item.Region_ID,
                Name       = item.Name,
                Address    = item.Address,
                Telp       = item.Telp,
                Email      = item.Email,
                CreationBy = item.CreationBy
            }, true);

            return(res);
        }
Example #22
0
        public static string EditMasterDataTBBM(MasterDataModel.MasterDataTBBM item)
        {
            string res = DbTransaction.DbToString("sp_EditMasterDataTBBM",
                                                  new
            {
                TBBM_ID_PK   = item.TBBM_ID_PK,
                Region_ID_FK = item.Region_ID_FK,
                Name         = item.Name,
                Address      = item.Address,
                Telp         = item.Telp,
                Email        = item.Email,
                UpdateBy     = item.UpdateBy
            }, true);

            return(res);
        }
Example #23
0
        protected void gvProductSP3M_RowUpdating(object sender, DevExpress.Web.Data.ASPxDataUpdatingEventArgs e)
        {
            //ListProductSP3M[gvProduct.EditingRowVisibleIndex].ProductID = (string)e.NewValues["NamaProduk"];
            //ListProductSP3M[gvProduct.EditingRowVisibleIndex].NamaProduk = (string)e.NewValues["NamaProduk"];
            //ListProductSP3M[gvProduct.EditingRowVisibleIndex].Kuantum = (float)e.NewValues["Kuantum"];
            //ListProductSP3M[gvProduct.EditingRowVisibleIndex].HargaSatuan = (float)e.NewValues["HargaSatuan"];
            //ListProductSP3M[gvProduct.EditingRowVisibleIndex].HargaJumlah = (float)e.NewValues["HargaJumlah"];

            //e.Cancel = true;
            //gvProduct.CancelEdit();

            string Response = string.Empty;

            try
            {
                int SP3MItem_ID = Convert.ToInt16(e.Keys[0]);
                Response = DbTransaction.DbToString("dbo.sp_EditSP3M_Item", new {
                    SP3M_Items_ID = SP3MItem_ID,
                    //product = e.NewValues["ProductName"],
                    productname    = e.NewValues["ProductName"],
                    unitcapacity   = 1,
                    quantityvolume = e.NewValues["QuantityVolume"],
                    priceunit      = e.NewValues["PriceUnit"],
                    userlogin      = UserProfile.Username
                }, true);

                e.Cancel = true;
                gvProductSP3M.CancelEdit();

                if (Response.Contains("Success"))
                {
                    alert.MessageString(Alert.SUCCESS, "Edit Product", Response, this.Page, GetType());
                }
                else
                {
                    alert.MessageString(Alert.WARNING, "Edit Product", Response, this.Page, GetType());
                }
            }
            catch (Exception ex)
            {
                alert.MessageString(Alert.ERROR, "Edit Product", ex.Message, this.Page, GetType());
            }
        }
Example #24
0
        protected void gvAuthParameter_RowInserting(object sender, DevExpress.Web.Data.ASPxDataInsertingEventArgs e)
        {
            string Response = string.Empty;

            try
            {
                //initialize control
                BootstrapGridView gv          = (BootstrapGridView)gvMasterDataUser;
                BootstrapTextBox  txtusername = (BootstrapTextBox)gv.FindEditFormTemplateControl("txtUserName");
                BootstrapGridView gridAuth    = (BootstrapGridView)gv.FindEditFormTemplateControl("gvAuthParameter");

                if (string.IsNullOrEmpty((string)e.NewValues["ParameterName"]) || string.IsNullOrEmpty((string)e.NewValues["ParameterValue"]))
                {
                    alert.MessageString(Alert.WARNING, "Add Authentication", "Parameter is not complete", this.Page, GetType());
                    e.Cancel = true;
                    return;
                }

                Response = DbTransaction.DbToString("dbo.sp_AddUserAuthentication", new
                {
                    username  = txtusername.Text,
                    name      = e.NewValues["ParameterName"],
                    value     = e.NewValues["ParameterValue"],
                    userlogin = UserProfile.Username
                }, true);

                if (Response.Contains("Success"))
                {
                    alert.MessageString(Alert.SUCCESS, "Add Authentication", Response, this.Page, GetType());
                    e.Cancel = true;
                    gridAuth.CancelEdit();
                }
                else
                {
                    alert.MessageString(Alert.WARNING, "Add Authentication", Response, this.Page, GetType());
                    e.Cancel = true;
                }
            }
            catch (Exception ex)
            {
                alert.MessageString(Alert.ERROR, "Add Authentication", ex.Message, this.Page, GetType());
            }
        }
Example #25
0
        public static string AddMasterDataDriver(MasterDataModel.MasterDataDriver item)
        {
            string res = DbTransaction.DbToString("sp_AddMasterDataDriver",
                                                  new
            {
                Transporter_ID = item.Transporter_ID,
                ImageName      = item.ImageName,
                ImageBytes     = item.ImageBytes,
                Name           = item.Name,
                Birthday       = item.Birthday,
                Address        = item.Address,
                Email          = item.Email,
                Phone1         = item.Phone1,
                Phone2         = item.Phone2,
                CreationBy     = item.CreationBy
            }, true);

            return(res);
        }
Example #26
0
        public static string AddMasterDataVehicle(MasterDataModel.MasterDataKendaraan item)
        {
            string res = DbTransaction.DbToString("sp_AddMasterDataVehicle",
                                                  new
            {
                Transporter_ID     = item.Transporter_ID,
                Number             = item.Number,
                Code               = item.Code,
                Merk               = item.Merk,
                YearManufacture    = item.YearManufacture,
                Type_ID            = item.Type_ID,
                VehicleCategory_ID = item.VehicleCategory_ID,
                Capacity           = item.Capacity,
                UnitCapacity_ID    = item.UnitCapacity_ID,
                CreationBy         = item.CreationBy
            }, true);

            return(res);
        }
Example #27
0
        public static string SubmitLO(LOModel.LO item)
        {
            string res = DbTransaction.DbToString("sp_SubmitLO",
                                                  new
            {
                SPP_Items_ID      = item.SPP_Items_ID,
                Transporter_ID    = item.Transporter_ID,
                Vehicle_ID        = item.Vehicle_ID,
                Driver_ID         = item.Driver_ID,
                NoLo              = item.NoLO,
                LODate            = item.LODate,
                NoDO              = item.NoDO,
                DODate            = item.DODate,
                CustomerPO_Number = item.CustomerPO_Number,
                CustomerDate      = item.CustomerDate,
                OrderNumber       = item.OrderNumber,
                OrderDate         = item.OrderDate,
                DeliveryNote      = item.DeliveryNote,
                CreationBy        = item.CreationBy
            }, true);

            return(res);
        }
Example #28
0
        protected void btnSaveHeader_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(txtInvoiceNumber.Text) ||
                string.IsNullOrEmpty(dateInvoice.Text))
            {
                alert.MessageString(Alert.WARNING, "Simpan Invoice", "Please Input Mandatory Fields", Page, GetType());
                return;
            }

            try
            {
                ResponseQuery = DbTransaction.DbToString("dbo.sp_AddInvoice_Header", new {
                    Type          = hfInvoiceType.Value,
                    InvoiceNumber = txtInvoiceNumber.Text,
                    InvoiceDate   = dateInvoice.Date == DateTime.MinValue ? Convert.ToDateTime("1/1/1900") : dateInvoice.Date,
                    ApproveBy     = txtApproveBy.Text,
                    Note          = txtNote.Text,
                    Status        = 1,
                    Username      = UserProfile.Username,
                    InvoiceId     = 0
                }, true);

                //show notification
                if (ResponseQuery.Contains("Success"))
                {
                    alert.MessageString(Alert.SUCCESS, "Simpan Invoice", ResponseQuery, this.Page, GetType());
                }
                else
                {
                    alert.MessageString(Alert.WARNING, "Simpan Invoice", ResponseQuery, this.Page, GetType());
                }
            }
            catch (Exception ex)
            {
                alert.MessageString(Alert.ERROR, "Simpan Invoice", ex.Message, this.Page, GetType());
            }
        }
Example #29
0
        protected void gridAddLO_CustomCallback(object sender, DevExpress.Web.ASPxGridViewCustomCallbackEventArgs e)
        {
            if (e.Parameters == "Checked")
            {
                //initialize variable
                string        InvoiceItem = string.Empty;
                string        NoDO        = string.Empty;
                float?        Product_ID;
                string        ProductName = string.Empty;
                float?        QuantityVolume;
                float?        PriceUnit;
                string        strItem     = string.Empty;
                List <Object> SelectItems = gridAddLO.GetSelectedFieldValues("LO_ID");
                foreach (object LoID in SelectItems)
                {
                    //set item selected
                    NoDO           = gridAddLO.GetRowValuesByKeyValue(LoID, "NoDO").ToString();
                    Product_ID     = Convert.ToInt16(gridAddLO.GetRowValuesByKeyValue(LoID, "Product_ID").ToString());
                    ProductName    = gridAddLO.GetRowValuesByKeyValue(LoID, "ProductName").ToString();
                    QuantityVolume = Convert.ToInt32(gridAddLO.GetRowValuesByKeyValue(LoID, "QuantityVolume").ToString());
                    PriceUnit      = Convert.ToInt64(gridAddLO.GetRowValuesByKeyValue(LoID, "PriceUnit").ToString());

                    //string item
                    strItem = LoID.ToString() + ';' + NoDO + ';' + Product_ID + ';' + QuantityVolume + ';' + PriceUnit;

                    ////add data to list
                    //ListInvoiceItem.Add(new InvoiceModel.InvoiceItem
                    //{
                    //    LO_ID = Convert.ToInt16(item),
                    //    NoLO = NoLO,
                    //    Product_ID = Convert.ToInt16(Product_ID),
                    //    ProductName = ProductName,
                    //    QuantityVolume = Convert.ToInt32(QuantityVolume),
                    //    PriceUnit = Convert.ToInt64(PriceUnit)
                    //});

                    //concatenate data LO
                    InvoiceItem += string.Format("{0}|", strItem);
                }

                //set product item
                if (!string.IsNullOrEmpty(InvoiceItem))
                {
                    InvoiceItem = InvoiceItem.Remove(InvoiceItem.Length - 1);
                }

                //insert data to database
                ResponseQuery = DbTransaction.DbToString("dbo.sp_AddInvoice_Item", new
                {
                    Type          = hfInvoiceType.Value,
                    InvoiceNumber = txtInvoiceNumber.Text,
                    ApproveBy     = txtApproveBy.Text ?? string.Empty,
                    InvoiceDate   = dateInvoice.Date == DateTime.MinValue ? Convert.ToDateTime("1/1/1900") : dateInvoice.Date,
                    Note          = txtNote.Text ?? string.Empty,
                    Status        = 1,
                    Userlogin     = UserProfile.Username,
                    InvoiceItem   = InvoiceItem
                }, true);

                //show notification
                gridAddLO.JSProperties["cpRes"] = ResponseQuery;
            }
        }
Example #30
0
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            string Response = string.Empty;

            try
            {
                if (gvProductSP3M.IsEditing == true)
                {
                    alert.MessageString(Alert.WARNING, "Simpan SP3M", "Data Produk sedang dalam proses edit. <br> Simpan/ batalkan terlebih dahulu perubahannya !!!", this.Page, GetType());
                    gvProductSP3M.Focus();
                    return;
                }

                //set sp3m id
                //set variable from query string
                SP3M_ID = string.IsNullOrEmpty((string)Request.QueryString["SP3M_ID"]) ? 0 : Convert.ToInt16(Request.QueryString["SP3M_ID"]);
                if (!String.IsNullOrEmpty((string)hfSP3MId.Get("Id")))
                {
                    SP3M_ID = Convert.ToInt16(hfSP3MId.Get("Id").ToString());
                }
                Response = DbTransaction.DbToString("dbo.sp_SubmitSP3M", new {
                    SP3M_ID   = SP3M_ID,
                    nosp3m    = txtSP3M_Number.Text.Trim(),
                    userlogin = UserProfile.Username
                }, true);

                if (Response.Contains("Success"))
                {
                    alert.MessageString(Alert.SUCCESS, "Submit SP3M", Response, this.Page, GetType());
                    SetEnabled(false);
                    SetEnabledButton(UserProfile.Roles, StatusSP3M);

                    //approve when user is internal
                    foreach (MasterDataModel.MasterDataRole role in UserProfile.Roles)
                    {
                        if (role.RoleName == UserProfile.USER_INTERNAL)
                        {
                            Response = DbTransaction.DbToString("dbo.sp_ApproveSP3M", new
                            {
                                SP3M_ID   = SP3M_ID,
                                nosp3m    = txtSP3M_Number.Text.Trim(),
                                userlogin = UserProfile.Username
                            }, true);

                            if (Response.Contains("Success"))
                            {
                                alert.MessageString(Alert.SUCCESS, "Approve SP3M", Response, this.Page, GetType());
                                SetEnabled(false);
                                SetEnabledButton(UserProfile.Roles, StatusSP3M);
                            }
                            else
                            {
                                alert.MessageString(Alert.WARNING, "Approve SP3M", Response, this.Page, GetType());
                            }
                        }
                    }
                }
                else
                {
                    alert.MessageString(Alert.WARNING, "Submit SP3M", Response, this.Page, GetType());
                }
            }
            catch (Exception ex)
            {
                alert.MessageString(Alert.ERROR, "Submit SP3M", ex.Message, this.Page, GetType());
            }
        }