Advertisement
Guest User

Untitled

a guest
Dec 9th, 2019
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1.  
  2. product.updateStock = (id, idt, idb, name, purchase, stock, selling, discount, cutting) => (
  3. new Promise((resolve, reject) => {
  4. let self = [idt, idb, name, purchase, stock, selling, discount, cutting, id]
  5. let sql = 'update tb_product set id_type=?, id_brand=?, prod_name=?, prod_stock=?, prod_purchase_price=?, prod_selling_price=?, prod_cutting=?, prod_discount=? where id_product=?'
  6.  
  7. db.query(sql, self, (err, results) => {
  8. if (err) {
  9. console.log(sql, err)
  10. return reject({ message: 'Failed updating data', error: true })
  11. }
  12. return resolve({
  13. message: 'Data Updated Has Successfully',
  14. data: results.affectedRows
  15. })
  16. })
  17. })
  18. )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement