Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- product.updateStock = (id, idt, idb, name, purchase, stock, selling, discount, cutting) => (
- new Promise((resolve, reject) => {
- let self = [idt, idb, name, purchase, stock, selling, discount, cutting, id]
- 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=?'
- db.query(sql, self, (err, results) => {
- if (err) {
- console.log(sql, err)
- return reject({ message: 'Failed updating data', error: true })
- }
- return resolve({
- message: 'Data Updated Has Successfully',
- data: results.affectedRows
- })
- })
- })
- )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement