is_valid_receipt (Receiving)

opensourcepos-mssql · application/models/Receiving.php · php · MIT
pos, tag:id-format, tag:reference-lookup

Validates a receipt or kit receiving identifier against existing records, supporting both formatted IDs and reference lookups.

// Source: https://github.com/jepuncolin/opensourcepos-mssql | License: MIT | Copyright 2013-2021 jekkos
// Provided via justclaw.it.com; keep this notice with the code.
	public function is_valid_receipt($receipt_receiving_id)
	{
		if(!empty($receipt_receiving_id))
		{
			//RECV #
			$pieces = explode(' ', $receipt_receiving_id);

			if(count($pieces) == 2 && preg_match('/(RECV|KIT)/', $pieces[0]))
			{
				return $this->exists($pieces[1]);
			}
			else
			{
				return $this->get_receiving_by_reference($receipt_receiving_id)->num_rows() > 0;
			}
		}

		return FALSE;
	}

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key