135 lines
2.3 KiB
PHP
135 lines
2.3 KiB
PHP
<?php
|
|
|
|
include ('../inc/includes.php');
|
|
|
|
|
|
function checkFamCodeExist($fam){
|
|
global $DB;
|
|
|
|
$query = "SELECT FAR_CODE FROM `Fam_Produit` WHERE FAR_CODE = ?";
|
|
|
|
|
|
$stmt = $DB->prepare($query);
|
|
|
|
$stmt->bind_param("s" , $fam);
|
|
|
|
$stmt->execute();
|
|
$result = $stmt->get_result();
|
|
|
|
if ($result->num_rows > 0)
|
|
return 1;
|
|
return 0;
|
|
}
|
|
|
|
|
|
function checkSFamCodeExist($sfam){
|
|
global $DB;
|
|
|
|
$query = "SELECT SFA_CODE FROM `Sous_Fam_Produit` WHERE SFA_CODE = ?";
|
|
|
|
|
|
$stmt = $DB->prepare($query);
|
|
|
|
$stmt->bind_param("s" , $sfam);
|
|
|
|
$stmt->execute();
|
|
$result = $stmt->get_result();
|
|
|
|
if ($result->num_rows > 0)
|
|
return 1;
|
|
return 0;
|
|
}
|
|
|
|
function checkFamExist($fam){
|
|
global $DB;
|
|
|
|
$query = "SELECT FAR_LIB FROM `Fam_Produit` WHERE FAR_LIB = ?";
|
|
|
|
|
|
$stmt = $DB->prepare($query);
|
|
|
|
$stmt->bind_param("s" , $fam);
|
|
|
|
$stmt->execute();
|
|
$result = $stmt->get_result();
|
|
|
|
if ($result->num_rows > 0)
|
|
return 1;
|
|
return 0;
|
|
}
|
|
|
|
|
|
function checkSFamExist($sfam){
|
|
global $DB;
|
|
|
|
$query = "SELECT SFA_LIB FROM `Sous_Fam_Produit` WHERE SFA_LIB = ?";
|
|
|
|
|
|
$stmt = $DB->prepare($query);
|
|
|
|
$stmt->bind_param("s" , $sfam);
|
|
|
|
$stmt->execute();
|
|
$result = $stmt->get_result();
|
|
|
|
if ($result->num_rows > 0)
|
|
return 1;
|
|
return 0;
|
|
}
|
|
|
|
function getFamLastId($code){
|
|
global $DB;
|
|
|
|
$query = "SELECT count(*) c FROM `Fam_Produit` WHERE `FAR_CODE` LIKE '%?%'";
|
|
$stmt = $DB->prepare($query);
|
|
|
|
$stmt->bind_param("s" , $code);
|
|
|
|
$stmt->execute();
|
|
$result = $stmt->get_result();
|
|
|
|
if ($result) {
|
|
return $result->fetch_assoc();
|
|
}
|
|
return null;
|
|
}
|
|
|
|
function getSFamLastId($code){
|
|
global $DB;
|
|
|
|
$query = "SELECT count(*) c FROM `Sous_Fam_Produit` WHERE `SFA_CODE` LIKE '%?%'";
|
|
$stmt = $DB->prepare($query);
|
|
|
|
$stmt->bind_param("s" , $code);
|
|
|
|
$stmt->execute();
|
|
$result = $stmt->get_result();
|
|
|
|
if ($result) {
|
|
return $result->fetch_assoc();
|
|
}
|
|
return null;
|
|
}
|
|
|
|
function addFamille($famcode,$famlib){
|
|
global $DB;
|
|
|
|
$query = "INSERT INTO `Fam_Produit`(`FAR_CODE`, `FAR_LIB`, `immobilisation`) VALUES (?,?,1)";
|
|
$stmt = $DB->prepare($query);
|
|
|
|
$stmt->bind_param("ss" , $famcode,$famlib);
|
|
|
|
return $stmt->execute();
|
|
}
|
|
|
|
function addSFamille($sfamcode,$sfamlib){
|
|
Global $DB;
|
|
|
|
$query = "INSERT INTO `Sous_Fam_Produit`(`SFA_CODE`, `SFA_LIB`, `immobilisation`) VALUES (?,?,1)";
|
|
$stmt = $DB->prepare($query);
|
|
|
|
$stmt->bind_param("ss" , $sfamcode,$sfamlib);
|
|
|
|
return $stmt->execute();
|
|
|
|
} |