Skip to content

Instantly share code, notes, and snippets.

@artpicassoo
Created October 7, 2016 05:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save artpicassoo/3c9dc38694528d2ccd8cf77090304045 to your computer and use it in GitHub Desktop.
Save artpicassoo/3c9dc38694528d2ccd8cf77090304045 to your computer and use it in GitHub Desktop.
<?php
if(isset($_POST['fisa']))
{
$Comanda=mysql_real_escape_string($_POST['Comanda']);
$query=mysql_query("select * from fisa where Comanda='$Comanda'");
$row=mysql_num_rows($query);
if($row==0)
{
echo "<span style='color:green;'>Comanda nou, OK</span>";
}
else
{
echo "<span style='color:red;'>Comanda este deja!</span>";
}
}
if(isset($_POST['submit'])){
$Imprimanta = $_POST['Imprimanta'];
$status_print = $_POST['status_print'];
$Material = $_POST['Material'];
$grosime = trim($_POST['grosime']);
$latimea = trim($_POST['latimea']);
$Comanda = trim($_POST['Comanda']);
$Beneficiar = trim($_POST['Beneficiar']);
$Nume = trim($_POST['Nume']);
$Client = trim($_POST['Client']);
$telefon = trim($_POST['telefon']);
$urgent = trim($_POST['urgent'] = (!empty($_POST['urgent'])) ? $_POST['urgent'] : '' );
$denumire_lucrare = trim($_POST['denumire_lucrare']);
$locatia = trim($_POST['locatia']);
$Lansare1 = trim($_POST['Lansare1']);
$Lansare2 = $_POST['Lansare2'];
$Predare1 = trim($_POST['Predare1']);
$Predare2 = trim($_POST['Predare2']);
$width_total = trim($_POST['width_total']);
$height_total = trim($_POST['height_total']);
$cantitate_total = trim($_POST['cantitate_total']);
$Latime_material = trim($_POST['Latime_material']);
$Total_lucrare = trim($_POST['Total_lucrare']);
$Total_consum = $_POST['Total_consum'];
$L_l = trim($_POST['L_l'] = (!empty($_POST['L_l'])) ? $_POST['L_l'] : '');
$L_M = trim($_POST['L_M'] = (!empty($_POST['L_M'])) ? $_POST['L_M'] : '' );
$Transfer = trim($_POST['Transfer'] = (!empty($_POST['Transfer'])) ? $_POST['Transfer'] : '' );
$D_C = trim($_POST['D_C'] = (!empty($_POST['D_C'])) ? $_POST['D_C'] : '' );
$C_P = trim($_POST['C_P'] = (!empty($_POST['C_P'])) ? $_POST['C_P'] : '' );
$Buzunare = trim($_POST['Buzunare'] = (!empty($_POST['Buzunare'])) ? $_POST['Buzunare'] : '' );
$Capse = trim($_POST['Capse'] = (!empty($_POST['Capse'])) ? $_POST['Capse'] : '' );
$Capse_colturi = ($_POST['Capse_colturi'] = (!empty($_POST['Capse_colturi'])) ? $_POST['Capse_colturi'] : '' );
$Sudura = trim($_POST['Sudura'] = (!empty($_POST['Sudura'])) ? $_POST['Sudura'] : '' );
$degresare = trim($_POST['degresare'] = (!empty($_POST['degresare'])) ? $_POST['degresare'] : '' );
$M_S_F = trim($_POST['M_S_F'] = (!empty($_POST['M_S_F'])) ? $_POST['M_S_F'] : '' );
$M_S_C = trim($_POST['M_S_C'] = (!empty($_POST['M_S_C'])) ? $_POST['M_S_C'] : '' );
$observati_dtp = $_POST['observati_dtp'];
$observati_montaj = trim($_POST['observati_montaj']);
$observati_client = trim($_POST['observati_client']);
$factura = $_POST['factura'];
$factura_total = $_POST['factura_total'];
$nu_factura = $_POST['nu_factura'];
$in_asteptare = $_POST['in_asteptare'];
$button_factura = $_POST['button_factura'];
$fisa_id = $_POST['fisa_id'];
$dtp = $_POST['dtp'];
$anulare = $_POST['anulare'];
$delete_fisa = $_POST['delete_fisa'];
$edit_factura = $_POST['edit_factura'];
$tva = $_POST['tva'];
$files = $_POST['files'];
mysql_query("INSERT INTO fisa SET Imprimanta='$Imprimanta', status_print='$status_print', Material='$Material', grosime='$grosime', latimea='$latimea',Comanda='$Comanda', Beneficiar='$Beneficiar', Nume='$Nume', Client='$Client', telefon='$telefon', urgent='$urgent', denumire_lucrare='$denumire_lucrare', locatia='$locatia', Lansare1='$Lansare1',
Lansare2='$Lansare2', Predare1='$Predare1', Predare2='$Predare2', width_total='$width_total', height_total='$height_total', cantitate_total='$cantitate_total', Latime_material='$Latime_material', Total_lucrare='$Total_lucrare', Total_consum='$Total_consum', L_l='$L_l', L_M='$L_M',
Transfer='$Transfer', D_C='$D_C', C_P='$C_P', Buzunare='$Buzunare', Capse='$Capse', Capse_colturi='$Capse_colturi', Sudura='$Sudura', degresare='$degresare', M_S_F='$M_S_F', M_S_C='$M_S_C', observati_dtp='$observati_dtp', observati_montaj='$observati_montaj',
observati_client='$observati_client', factura='$factura', factura_total='$factura_total', nu_factura='$nu_factura', in_asteptare='$in_asteptare', button_factura='$button_factura', fisa_id='$fisa_id', dtp='$dtp', anulare='$anulare', delete_fisa='$delete_fisa', edit_factura='$edit_factura', tva='$tva', files='$files' ");
// mysqli_close($conn);
mysql_query('
INSERT INTO chart_sales (date, sales_order) VALUES (Now(), 1)
ON DUPLICATE KEY UPDATE sales_order =sales_order +1');
}
echo "<script>window.close();</script>";
?>
<?php
$mysqli->query('
INSERT INTO chart_sales (date, sales_order) VALUES (Now(), 1)
ON DUPLICATE KEY UPDATE sales_order =sales_order 1');
echo "<script>window.close();</script>";
?>
<?php
$tablename = "fisa";
$qShowStatus = "SHOW TABLE STATUS LIKE '$tablename'";
$qShowStatusResult = mysql_query($qShowStatus) or die ( "" . mysql_error() . "" . $qShowStatus );
$row = mysql_fetch_assoc($qShowStatusResult);
$next_increment = $row['Auto_increment'];
echo "$next_increment";
$tablename = (string)("$next_increment");
$year = date("Y");
$month = date("m");
$day = date("d");
If(!file_exists($year)){
$createsyear = mkdir("$year", 0777);
}
else
{
If(!file_exists("$year/$month")){
$createsmonth = mkdir("$year/$month", 0777);
}
else
{
If(!file_exists("$year/$month/$day")){
$createsday = mkdir("$year/$month/$day", 0777);
}
else
{
If(!file_exists($year/$month/$day)){
$createsday = mkdir("$year/$month/$day/$tablename/", 0777);
}
else
{
}
}
}
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment