Jump to content

FooKelvin

Members
  • Posts

    138
  • Joined

  • Last visited

Everything posted by FooKelvin

  1. I would like to have this +3 apply when the paymentterm if is less than 45. So the current code is using case statement. SELECT SUM(sblPOAmount) AS totalPOAmt, case when paymentTerm = '45 Days' then DATENAME(Day, DATEADD(day, SUBSTRING(paymentTerm, 1, 2) + 3, SBLInvoiceDate)) else DATENAME(Day, DATEADD(day, SUBSTRING(paymentTerm, 1, 2) + 0, SBLInvoiceDate)) end FROM [A_Sys].[dbo].[Eventtbl] WHERE DATENAME(MONTH, DATEADD(day,SUBSTRING(paymentTerm, 1, 2)+3,SBLInvoiceDate))='June' AND DATENAME(YEAR, DATEADD(day,SUBSTRING(paymentTerm, 1, 2)+3,SBLInvoiceDate))='2017' Group By paymentTerm,SBLInvoiceDate The Sum having multiple result due to "Group By", but if i run it without Group By , it will have error message. Please help
  2. Hi All, I have generate a form which contain the id and name. the name and id i use php foreach them from database, to make it simple, im just copy the HTML and paste it here. each of them have individual approval status and remarks. once submit, it should update individual rows. I am using ajax to post. My current code. <html> <body> <hr> <section> <h3 id="title454"> Requestor </h3> </section> <form id="form" action="" method="post"> <table> <tr> <th>Employee Name</th> <th>Employee ID</th> <th>Remark</th> <th>Action</th> </tr> <tr><td>Kelvin</td><td>EE123</td><td><textarea name="remark[]"></textarea></td><td><select name="status[]"><option disabled value="">-Pending-</option><option value="Approved">Approve</option><option value="Reject">Reject</option></select><br></td></tr><tr><td>James</td><td>EE156</td><td><textarea name="remark[]"></textarea></td><td><select name="status[]"><option disabled value="">-Pending-</option><option value="Approved">Approve</option><option value="Reject">Reject</option></select><br></td></tr></table> <hr> <table> <ul> <section> <h3 id="title454"> 1st Level Approval </h3> </section> <li> <label>Amount Approved</label> <span> <select name="amount-approved"> <option disabled value="" selected>-Select-</option> <option>50%</option> <option>100%</option> </select> </span> </li> </ul> </table> <input id="submit" type="button" name="submit" value="submit"> </form> <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script> <script> $(document).ready(function(){ // click on button submit $("#submit").on('click', function(){ // send ajax $.ajax({ url: 'tier_one_submit_status.php', // url where to submit the request type : "POST", // type of action POST || GET dataType : 'json', // data type data : $("#form").serialize(), // post data || get data success : function(result) { // you can see the result from the console // tab of the developer tools console.log(result); }, error: function(xhr, resp, text) { console.log(xhr, resp, text); } }) }); }); </script> </body> </html> after click the submit button, i would like to update the data individually. Please help.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.