Jump to content
Sign in to follow this  

Não lançar com Stock negativo

Recommended Posts


Ola Ilustres!

quero que não lance o produto se o stock estar zero, e não sei como fazer ou como começar por favor se alguem saber agradeço a ajuda

function get_product($code = NULL) {

		if($this->input->get('code')) { $code = $this->input->get('code'); }
		$combo_items = FALSE;
		if($product = $this->pos_model->getProductByCode($code)) {
			unset($product->cost, $product->details);
			$product->qty = 1;
			$product->discount = '0';
			$product->real_unit_price = $product->price;
			$product->unit_price = $product->tax ? ($product->price+(($product->price*$product->tax)/100)) : $product->price;
			if ($product->type == 'combo') {
				$combo_items = $this->pos_model->getComboItemsByPID($product->id);
			echo json_encode(array('id' => str_replace(".", "", microtime(true)), 'item_id' => $product->id, 'label' => $product->name . " (" . $product->code . ")", 'row' => $product, 'combo_items' => $combo_items));
		} else {
			echo NULL;



Share this post

Link to post
Share on other sites

1º fazes uma busca do stock do produto ($code) ,

ex: crias um função stock_product($code){ return $quantidade; }

se a mesma retornar valor acima de 0 executa a função get_product($code)  caso contrário não.


Edited by N3lson

You can't do it, kid. But don't worry, my boy. You're not the only one. No one else can do it.

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. 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.