コード例 #1
0
ファイル: aditmcatsv.php プロジェクト: renjithnk/vyapary
function fnsv($upmd, $ppid, $ptitle, $pprnt, $pdelvmthd, $pstkupd, $pordr, $ppht1, $ptsts, $mde)
{
    require "dbfl.php";
    $kcon = mysqli_connect($hst, $nu, $dp, $dab) or die(mysqli_error());
    if (!$kcon) {
        die('Could not connect. Try again later');
    }
    if ($upmd == "nw") {
        $propno = 1;
        $result = mysqli_query($kcon, "select ifnull(max(IC_UID),0)  'prpno' from item_category ");
        //if (!$result)
        //{
        $row = mysqli_fetch_array($result);
        $propno = $row['prpno'];
        $propno = $propno + 1;
        //}
        //else
        //{
        //	$propno=1;
        //}
    } elseif ($upmd == "cg") {
        $sqlstr = "select IC_UID from item_category where IC_ID=" . $ppid;
        $result = mysqli_query($kcon, $sqlstr);
        $row = mysqli_fetch_array($result);
        $propno = $row['IC_UID'];
    }
    $ptrgpx = "";
    $ptrgpxsp = "";
    $ptrg = $propno;
    $ptrgsxsp = "";
    $ptrgsx = "";
    $sverr = 0;
    try {
        if ($ppht1 != "") {
            $uflname1 = $catupflprfx . $propno . "." . end(explode(".", $ppht1));
        } elseif ($ppht1 == "" && $upmd == "nw") {
            $uflname1 = "";
        } else {
            $uflname1 = "";
        }
        //echo "fl". $uflname1;
        if ($upmd == "nw") {
            $sqlstr = "insert into item_category (IC_UID,IC_PR_ID,IC_DISP_ORDR,  IC_NAME, IC_IMG,IC_DV_ID,IC_STK_UPDTD,IC_DESC,IC_ST_ID) values (" . $ptrg . "," . $pprnt . "," . $pordr . ",'" . $ptitle . "','" . $uflname1 . "'," . $pdelvmthd . "," . $pstkupd . ",'',1)";
            //	echo $sqlstr;
            mysqli_query($kcon, $sqlstr);
        } else {
            $updstr = "";
            if ($uflname1 != "") {
                if ($updstr != "") {
                    $updstr = $updstr . ", " . "IC_IMG='" . $uflname1 . "'";
                } else {
                    $updstr = " IC_IMG='" . $uflname1 . "'";
                }
            }
            $ptsts = 1;
            $sqlstr = "update item_category set IC_UID=" . $ptrg . ", IC_PR_ID=" . $pprnt . ", IC_DISP_ORDR=" . $pordr . ", IC_NAME='" . $ptitle . "', IC_ST_ID=" . $ptsts;
            if ($updstr != "") {
                $sqlstr = $sqlstr . ", " . $updstr . " where IC_ID=" . $ppid;
            } else {
                $sqlstr = $sqlstr . " where IC_ID=" . $ppid;
            }
            //	echo $sqlstr;
            mysqli_query($kcon, $sqlstr);
        }
        $upderr = 0;
        if ($ppht1 != "" && $upderr == 0 && $sverr == 0) {
            if ($_FILES["tbphtblk"]["error"] > 0) {
            } else {
                $uflext = end(explode(".", $_FILES["tbphtblk"]["name"]));
                $uflname = $_FILES["tbphtblk"]["name"];
                $uflsize = $_FILES["tbphtblk"]["size"];
                $ufltype = $_FILES["tbphtblk"]["type"];
                $ufltmpname = $_FILES["tbphtblk"]["tmp_name"];
                //echo "inf:ext" . $uflext;
                //	echo "inf:nme" . $uflname;
                //echo "inf:sze" . $uflsize;
                //echo "inf:typ" . $ufltype;
                //echo "inf:tmp" . $ufltmpname;
                if (fnUpld($catupflprfx . $propno . "." . $uflext, $phtpth, $uflext, $uflname, $ufltype, $uflsize, $ufltmpname)) {
                    include "MngImg.php";
                    $hght = 125;
                    $wdth = 125;
                    $thmbflname = $phtpth . $catrzflprfx . $catupflprfx . $propno . "." . $uflext;
                    $timg = new MngImg();
                    $timg->load($phtpth . $catupflprfx . $propno . "." . $uflext);
                    $timg->resize($hght, $wdth);
                    $timg->save($thmbflname);
                    /*
                    					//		echo "upd 11";
                    						include("MngImg.php");
                    						$thmbflname= $phtpth. $propno . "_tmb." . $uflext;
                    						$timg= new MngImg();
                    						$timg->load($phtpth . $propno  . "_1b" . "." . $uflext);
                    						$timg->resize(95,70);
                    						$timg->save($thmbflname);
                    					//	$timg->destroy();
                    						
                    						$thmbflname= $phtpth. $propno . "_1." . $uflext;
                    						//$timg= new MngImg();
                    						$timg->load($phtpth . $propno  . "_1b" . "." . $uflext);
                    						$timg->resize(260,190);
                    						$timg->save($thmbflname);
                    					//	$timg->destroy();
                    
                    						$thmbflname= $phtpth . $pthzmchr . "ctg_" . $propno . "." . $uflext;
                    						//$timg= new MngImg();
                    						$timg->load($phtpth . "ct_" . $propno  .  "." . $uflext);
                    						$timg->resize(720,420);
                    						$timg->save($thmbflname);
                    					//	$timg->destroy();
                    					
                    						if (file_exists($phtpth . $propno  . "_1b" . "." . $uflext))
                    						{
                    							fnUnldFile($phtpth , $propno  . "_1b" . "." . $uflext);
                    						}*/
                    $upderr = 0;
                } else {
                    //			echo "upd 2";
                    $upderr = 1;
                }
            }
        }
        //echo "uer" . $upderr;
        //echo "ser" . $sverr;
        //echo $upderr;
        if ($upderr == 0) {
            return true;
        } else {
            return false;
        }
    } catch (Exception $e) {
    }
}
コード例 #2
0
ファイル: addphtsv.php プロジェクト: renjithnk/clearvision
function fnSv($ppht1, $pgdes, $pgalbm, $pgordr, $pgsts)
{
    try {
        require "dbfl.php";
        $kcon = mysqli_connect($hst, $nu, $dp, $dab) or die(mysqli_error());
        if (!$kcon) {
            die('Could not connect. Try again later');
        }
        //mysqli_select_db($kcon,$dab) or die(mysqli_error());
        $flprpg = "pg";
        $result = mysqli_query($kcon, "select ifnull(max(phno),0)  'phno' from pg");
        if (!$result) {
            die(mysqli_error($kcon));
        }
        $row = mysqli_fetch_array($result);
        $phno = $row['phno'];
        $phno = $phno + 1;
        if ($ppht1 != "") {
            $uflname1 = $flprpg . $phno . "." . end(explode(".", $ppht1));
        } else {
            $uflname1 = "noimg.jpg";
        }
        $sqlstr = "insert into pg (phno,pth,pgdesc,albm,ordr,sts) values (" . $phno . ",'" . $uflname1 . "','" . $pgdes . "','" . $pgalbm . "'," . intval($pgordr) . "," . $pgsts . ")";
        //	echo $sqlstr;
        mysqli_query($kcon, $sqlstr);
        $sverr = 0;
        $upderr = 0;
    } catch (Exception $e) {
        $sverr = 1;
    }
    if ($ppht1 != "" && $upderr == 0 && $sverr == 0) {
        if ($_FILES["tbfile"]["error"] > 0) {
        } else {
            $uflext = end(explode(".", $_FILES["tbfile"]["name"]));
            $uflname = $_FILES["tbfile"]["name"];
            $uflsize = $_FILES["tbfile"]["size"];
            $ufltype = $_FILES["tbfile"]["type"];
            $ufltmpname = $_FILES["tbfile"]["tmp_name"];
            //echo "inf:ext" . $uflext;
            //e/cho "inf:nme" . $uflname;
            //echo "inf:sze" . $uflsize;
            //echo "inf:typ" . $ufltype;
            //echo "inf:tmp" . $ufltmpname;
            echo "new path" . $phtpth;
            if (fnUpld($uflname1, $phtpth, $uflext, $uflname, $ufltype, $uflsize, $ufltmpname)) {
                include "MngImg.php";
                $thmbflname = $phtpth . "tmb_" . $flprpg . $phno . "." . $uflext;
                $timg = new MngImg();
                $timg->load($phtpth . $flprpg . $phno . "" . "." . $uflext);
                $timg->resize(125, 85);
                $timg->save($thmbflname);
                //	$timg->destroy();
                $thmbflname = $phtpth . "fv_" . $flprpg . $phno . "." . $uflext;
                //$timg= new MngImg();
                $timg->load($phtpth . $flprpg . $phno . "" . "." . $uflext);
                $timg->resize(720, 420);
                $timg->save($thmbflname);
                //	$timg->destroy();
                //	echo "upd 11";
                $upderr = 0;
            } else {
                //	echo "upd 2";
                $upderr = 1;
            }
        }
    }
    if ($upderr == 0 && $sverr == 0) {
        return true;
    } else {
        return false;
    }
}
コード例 #3
0
ファイル: aditmsv.php プロジェクト: renjithnk/vyapary
function fnsv($upmd, $pitid, $pcyid, $pordr, $pcode, $ptit, $pdesc, $pbrcode, $pqrcode, $pprid, $pdate, $pbrnd, $ptyp, $pcatg, $ptxct, $ppht1, $pminqty, $pmumid, $pmaxqty, $pmumid, $ppck, $ppunt, $psunt, $pisstkd, $plmid, $pstrpcs, $prordr, $prumid, $pnortedt, $pnopksl, $pprc, $pofrprc, $pofrmsg, $pcurstk, $ptrsts, $pupsts)
{
    require "dbfl.php";
    $kcon = mysqli_connect($hst, $nu, $dp, $dab) or die(mysqli_error());
    if (!$kcon) {
        die('Could not connect. Try again later');
    }
    $propno = -1;
    if ($upmd == "nw") {
        $result = mysqli_query($kcon, "select ifnull(max(IM_UID),0)  'prpno' from item_master ");
        $row = mysqli_fetch_array($result);
        $propno = $row['prpno'];
        $propno = $propno + 1;
    } elseif ($upmd == "cg") {
        $sqlstr = "select IM_UID from item_master where IM_ID=" . $pitid;
        $result = mysqli_query($kcon, $sqlstr);
        $row = mysqli_fetch_array($result);
        $propno = $row['IM_UID'];
    }
    $ptrgpx = "";
    $ptrgpxsp = "";
    $ptrg = $propno;
    $ptrgsxsp = "";
    $ptrgsx = "";
    $sverr = 0;
    try {
        if ($ppht1 != "") {
            $strexp = explode(".", $ppht1);
            $uflname1 = $itmupflprfx . $propno . "." . end($strexp);
        } elseif ($ppht1 == "" && $upmd == "nw") {
            $uflname1 = "";
        } else {
            $uflname1 = "";
        }
        //echo "fl". $uflname1;
        if ($upmd == "nw") {
            $sqlstr = "insert into item_master (IM_CY_ID,IM_UID,IM_DISP_ORDR,IM_CODE,  IM_NAME,IM_DESC,\n\t\t\t\tIM_BARCODE,IM_QCODE,IM_PR_ID,IM_DATE,IM_BR_ID,IM_TY_ID,IM_IC_ID, IM_IMG,IM_PRCE,IM_OFRPRCE,IM_OFRMSG,IM_CURSTK,IM_MIN_QTY,\n\t\t\t\tIM_MNQTY_UID,IM_MAX_QTY,IM_MXQTY_UID,IM_PK_ID,IM_PUM_ID,IM_SUM_ID,IM_IS_STKD,\n\t\t\t\tIM_LM_ID,IM_STR_PCS,IM_REORDR,IM_R_UM_ID,IM_NO_RTEDT,IM_ON_PKSL,IM_ST_ID) values (" . $pcyid . "," . $propno . "," . $pordr . ",'" . $pcode . "','" . $ptit . "','" . $pdesc . "','" . $pbrcode . "','" . $pqrcode . "'," . $pprid . ",'" . $pdate . "'," . $pbrnd . "," . $ptyp . "," . $pcatg . ",'" . $uflname1 . "'," . $pprc . "," . $pofrprc . ",'" . $pofrmsg . "'," . $pcurstk . "," . $pminqty . "," . $pmumid . "," . $pmaxqty . "," . $pmumid . "," . $ppck . "," . $ppunt . "," . $psunt . "," . $pisstkd . "," . $plmid . "," . $pstrpcs . "," . $prordr . "," . $prumid . "," . $pnortedt . "," . $pnopksl . "," . $ptrsts . ")";
            //echo $sqlstr;
            mysqli_query($kcon, $sqlstr);
        } else {
            $updstr = "";
            if ($uflname1 != "") {
                if ($updstr != "") {
                    $updstr = $updstr . ", " . "IM_IMG='" . $uflname1 . "'";
                } else {
                    $updstr = " IM_IMG='" . $uflname1 . "'";
                }
            }
            $ptsts = 1;
            $sqlstr = "update item_master set IM_CY_ID=" . $pcyid . ",IM_UID=" . $propno . ",IM_DISP_ORDR=" . $pordr . ",IM_CODE='" . $pcode . "',  IM_NAME='" . $ptit . "',  IM_DESC='" . $pdesc . "',IM_BARCODE='" . $pbrcode . "',IM_QCODE='" . $pqrcode . "',IM_PR_ID=" . $pprid . ",IM_DATE='" . $pdate . "',IM_BR_ID=" . $pbrnd . ",IM_TY_ID=" . $ptyp . ",IM_IC_ID=" . $pcatg . ", IM_PRCE=" . $pprc . ",  IM_OFRPRCE =" . $pofrprc . " ,IM_OFRMSG='" . $pofrmsg . "',IM_CURSTK=" . $pcurstk . " ,IM_MIN_QTY=" . $pminqty . ",IM_MNQTY_UID=" . $pmumid . ",IM_MAX_QTY=" . $pmaxqty . ",IM_MXQTY_UID=" . $pmumid . ",IM_PK_ID=" . $ppck . ",IM_PUM_ID=" . $ppunt . ",IM_SUM_ID=" . $psunt . ",IM_IS_STKD=" . $pisstkd . ",IM_LM_ID=" . $plmid . ",IM_STR_PCS=" . $pstrpcs . ",IM_REORDR=" . $prordr . ",IM_R_UM_ID=" . $prumid . ",IM_NO_RTEDT=" . $pnortedt . ",IM_ON_PKSL=" . $pnopksl . ",IM_ST_ID=" . $ptrsts;
            if ($updstr != "") {
                $sqlstr = $sqlstr . ", " . $updstr . " where IM_ID=" . $pitid;
            } else {
                $sqlstr = $sqlstr . " where IM_ID=" . $pitid;
            }
            //echo $sqlstr;
            mysqli_query($kcon, $sqlstr);
        }
        $upderr = 0;
        if ($ppht1 != "" && $upderr == 0 && $sverr == 0) {
            if ($_FILES["tbphtblk"]["error"] > 0) {
            } else {
                $strexp = explode(".", $_FILES["tbphtblk"]["name"]);
                $uflext = end($strexp);
                $uflname = $_FILES["tbphtblk"]["name"];
                $uflsize = $_FILES["tbphtblk"]["size"];
                $ufltype = $_FILES["tbphtblk"]["type"];
                $ufltmpname = $_FILES["tbphtblk"]["tmp_name"];
                //echo "inf:ext" . $uflext;
                //	echo "inf:nme" . $uflname;
                //echo "inf:sze" . $uflsize;
                //echo "inf:typ" . $ufltype;
                //echo "inf:tmp" . $ufltmpname;
                if (fnUpld($itmupflprfx . $propno . "." . $uflext, $phtpth, $uflext, $uflname, $ufltype, $uflsize, $ufltmpname)) {
                    //		echo "upd 11";
                    include "MngImg.php";
                    $hght = 125;
                    $wdth = 125;
                    $thmbflname = $phtpth . $itmrzflprfx125 . $itmupflprfx . $propno . "." . $uflext;
                    $timg = new MngImg();
                    $timg->load($phtpth . $itmupflprfx . $propno . "." . $uflext);
                    $timg->resize($hght, $wdth);
                    $timg->save($thmbflname);
                    //	$timg->destroy();
                    $hght = 405;
                    $wdth = 405;
                    $thmbflname = $phtpth . $itmrzflprfx405 . $itmupflprfx . $propno . "." . $uflext;
                    //$timg= new MngImg();
                    $timg->load($phtpth . $itmupflprfx . $propno . "." . $uflext);
                    $timg->resize($hght, $wdth);
                    $timg->save($thmbflname);
                    //	$timg->destroy();
                    /*
                    						$thmbflname= $phtpth . $pthzmchr . "ctg_" . $propno . "." . $uflext;
                    						//$timg= new MngImg();
                    						$timg->load($phtpth . "ct_" . $propno  .  "." . $uflext);
                    						$timg->resize(720,420);
                    						$timg->save($thmbflname);
                    					//	$timg->destroy();
                    					
                    						if (file_exists($phtpth . $propno  . "_1b" . "." . $uflext))
                    						{
                    							fnUnldFile($phtpth , $propno  . "_1b" . "." . $uflext);
                    						}*/
                    $upderr = 0;
                } else {
                    //			echo "upd 2";
                    $upderr = 1;
                }
            }
        }
        //echo "uer" . $upderr;
        //echo "ser" . $sverr;
        //echo $upderr;
        if ($upderr == 0) {
            return true;
        } else {
            return false;
        }
    } catch (Exception $e) {
        echo $e;
    }
}