Example #1
0
function getNextNo($iType, $frm){
    $strSQL = "SELECT full_no,next_no from mr where type = '$iType'";
    $lastNo = execSQLReturn($strSQL);
    $lastNOdb = $lastNo['full_no'];
    $nextNO = $lastNOdb;
    if ($lastNo['in_use']==1){
        if ($lastNo['next_no']==1){
            updateNextNo($iType,$lastNo['next_no']+1,$lastNOdb, $frm);
            $nextNO = $lastNo['full_no'];
        }else{        
            $baseType = substr($lastNOdb,0,4);
//            $baseDate = substr($lastNOdb,4,-4);
            $baseDate = date("dmy");
            $baseFormat = substr($lastNOdb,0,-4);
            $baseCountZero = substr($lastNOdb,-4);        
            $baseCount = (int)$baseCountZero;
            $differs = strlen(trim($baseCountZero)) - strlen($baseCount);
            $zeroMarch="";
            for ($s=1;$s<=($differs);$s++){
                $zeroMarch .="0";
            }        
            $baseCountZero = (int)$lastNo['next_no']  ;
            $baseFormat = $baseType.$baseDate;
            $nextNO = $baseFormat.$zeroMarch.$baseCountZero ;
            updateNextNo($iType,$baseCountZero+1,$nextNO,$frm);
        }
    }
    $useThis = trim($nextNO) ;
    execSQL("update mr set in_use=1 where type='$iType'");
    return ($useThis);
}
Example #2
0
            $toDBDetADisc       = $_POST['txtADisc'.$i];
            $toDBDetSubtotal    = $_POST['txtSubtotal'.$i];
            $toDBDetID          = $_POST['po_detid'.$i];
            $strSQLUpdDet = "UPDATE purchase_orderdetail
                            SET satuan_po='$toDBDetSatuan', harga_po= '$toDBDetHarga', 
                            qty_po= '$toDBDetQty', discount='$toDBDetDisc' , amount_discount='$toDBDetADisc',
                            subtotal= '$toDBDetSubtotal', updated_datetime=now(), updated_user='******' 
                            WHERE no_po= '$noPO' and fld01= $suppID and no_spb= '$noReq' and id = $toDBDetID
                            ";
            mysql_query($strSQLUpdDet) or die("FAILED UPPDet.F5!! <br /> Please contact PT. Priatman ");;
          //  print($items. "::" . $strSQLUpdDet . "<br />");
        }
        //die ();
        $strTmp = "Select SUM(subtotal)as subtotal, count(id) as total_items from purchase_orderdetail 
                   WHERE no_po='$noPO' and no_spb= '$noReq' and fld01=$suppID group by no_po ";
        $fetchTmp = execSQLReturn($strTmp);
        $subtotalDetail = $fetchTmp['subtotal']; 
        $totalItems = $fetchTmp['total_items'];
        //die(print "$noPO   ::   $noReq    ::    $subtotalDetail   ::   $items   ::   $dbPO  ::   $flags   :: $suppID");
        $strSQLUpd = "UPDATE purchase_order 
                      SET grand_total ='$subtotalDetail', total_items ='$totalItems', flags=3, 
                      updated_datetime=now(), updated_user='******'
                      WHERE po_no ='$noPO' and id_supplier='$suppID' and request_no ='$noReq' and id='$poID' ";
//        die($strSQLUpd);
        mysql_query($strSQLUpd) or die("FAILED UPPHead.F5!! <br /> Please contact PT. Priatman ".mysql_error());
        die("<meta http-equiv='refresh' content='0;url=home.php?hal=content/list_po'>");
    break;
}
/********************************* IGNORE THIS PLEASE **************************************\
        $noPO = $_POST['no_po'];
        $noReq = $_POST['po_reqno'];
Example #3
0
<?php

/**
 * @author Richard
 * @copyright 2011
 * @internal purchase order retur processor.
 */
if(isset($_GET[stream])){
    $detID=$_GET[stream];
    if (empty($detID)){
        echo("<script language='javascript'>window.opener.location.reload();window.close();</script>");
    }else{
     $poRetNo   = getNextNo('RPO','action/po_receive_go');
     $poNoRet   = getNextNo('PO', 'action/po_receive_go');
     $strSQLGet = "SELECT * FROM purchase_orderdetail WHERE id=$detID";
     $fetchTmp  = execSQLReturn($strSQLGet);
     $rtrPONO   = $fetchTmp['no_po'];
     $rtrNoReq  = $fetchTmp['no_spb'];
     $rtrSuppID = $fetchTmp['fld01'];
     $rtrQty    = $fetchTmp['qty_po'];
     $rtrHarga  = $fetchTmp['harga_po'];
     $rtrDisc   = $fetchTmp['discount'];
     $rtrADisc  = $fetchTmp['amount_discount'];
     $rtrSubTot = $fetchTmp['subtotal'];
     $rtrBarID  = $fetchTmp['barang_id'];
     $strGetMs  = "Select kd_barang from ms_barang where id= $rtrBarID";
     $rtrBarName= getSingleData($strGetMs);
     $remarks   = "Item Retur: $rtrBarName \n Retur No: $poRetNo";
     $strSQLUpd = "UPDATE purchase_order SET remark='$remarks', fld03='$poRetNo', fld04= now(), 
                   updated_datetime=now(), updated_user='******'
                   where po_no = '$rtrONO' and request_no= '$rtrNoReq' and id_supplier= $rtrSuppID ";
Example #4
0
if (($idPO == 0) || ($isManual==1)){die("<meta http-equiv='refresh' content='0;url=home.php?hal=content/po_man' /> ");
}else{    
}
//print $idPO;
$strSQLHeader = "SELECT 
                a.po_no , a.request_no as po_reqno, (date_format(a.tgl_po, '%d/%m/%Y')) as po_tgl, b.nama as supplier,
                (case a.flags when 1 then 'Closed' when 2 then 'Receiving'
                when 3 then 'Approved' when 4 then 'Open' when 5 then 'Generated' when 6 then 'Canceled' END) as status, 
                a.created_user as creator, a.flags as flags, a.btb_no, a.penerima, a.total_price, a.percent_discount,
                a.discount_amount, a.ppn_amount, a.grand_total 
               FROM purchase_order a 
               INNER JOIN pbf b ON 
                a.id_supplier = b.id
               ";
if (!empty($idPO)){$strSQLHeader    .= "WHERE a.id = $idPO"; }
$resHeader = execSQLReturn($strSQLHeader);
global $poSTBNo;
global $poSTBUser;
global $poTotPrice;
global $poTotDisc;
global $poTotADisc;
global $poTotPPN;
global $poTotGrand;
global $poStatus;
$poNO       = $resHeader[po_no];
$poReqNo    = $resHeader[po_reqno];
$poDate     = $resHeader[po_tgl];
$poCreator  = $resHeader[creator];
$poStatus   = $resHeader[status];
$poSupplier = $resHeader[supplier];
$flags      = $resHeader[flags];
Example #5
0
        on
              a.id = d.barang_id
        inner join
              purchase_orderdetail b
        on
              a.id = b.barang_id
        left outer join
              purchase_order c
        on
              b.no_po = c.po_no and b.no_spb = c.request_no and b.fld01 = c.id_supplier
        inner join 
              pbf e
        on 
              e.id=c.id_supplier 
        where b.f_revisi =0 and c.id=$idPO";
$fetchPrint = execSQLReturn($strPOPrint);
?>

<link rel="stylesheet" type="text/css" href="../include/style.css"/>
<center><fieldset style="width:90%;"><legend style="background-color:#1bda01;"><b><font color="#fefafa" style="font-size:14px;">&nbsp;&nbsp;PO no <?=$poNO?>&nbsp;&nbsp;</font></b></legend>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
	<tr>
		<td>
		<table border="0" width="100%" cellpadding="0" cellspacing="0">
			<tr>
				<td width="8px">&nbsp;</td>
				<td width="300px" bgcolor="#9b9999">&nbsp;&nbsp;<font style="font-size:14px; " color="#fefafa"><b>PURCHASE ORDER </b></font></td>
				<td></td>
			</tr>
		</table>
		</td>