<?php

    
    if($_REQUEST['id']==0) {
        $where=" WHERE ftpayroll_slip_no='{$_REQUEST['ftpayroll_slip_no']}' AND
                       ftemployee_code='{$_REQUEST['ftemployee_code']}' #";

        $ssql="SELECT fnid
                FROM txpayroll_slip_emp
                {$where}";

        $_REQUEST['id']=RetRstField($ssql);
    }
    else {
         $ssql="SELECT ftpayroll_slip_no 
                FROM txpayroll_slip_emp
                WHERE fnid='{$_REQUEST['id']}'";
          $_REQUEST['ftpayroll_slip_no']=RetRstField($ssql);
         $ssql="SELECT ftemployee_code
                FROM txpayroll_slip_emp
                WHERE fnid='{$_REQUEST['id']}'";
          $_REQUEST['ftemployee_code']=RetRstField($ssql);
           $where=" WHERE ftpayroll_slip_no='{$_REQUEST['ftpayroll_slip_no']}' AND
                       ftemployee_code='{$_REQUEST['ftemployee_code']}' #";
    
         
    }
    
            $ssql1x="select sum(fcamount) as fcamount from txpayroll_slip_inc_plus where ftemployee_code='".($_REQUEST['ftemployee_code'])."' AND  ftpayroll_slip_no='".($_REQUEST['ftpayroll_slip_no'])."'";
            $ssql2x="select sum(fcamount) as fcamount from txpayroll_slip_dec where ftemployee_code='".($_REQUEST['ftemployee_code'])."' AND  ftpayroll_slip_no='".($_REQUEST['ftpayroll_slip_no'])."'";
            $fcincome_amountD0=(RetRstField($ssql1x));
            $fcdeduction_amountD0=(RetRstField($ssql2x));
            $fcamountD0=($fcincome_amountD0-$fcdeduction_amountD0);
             $fcincome_amountD0=number_format($fcincome_amountD0,2);
            $fcdeduction_amountD0=number_format($fcdeduction_amountD0,2);
            $fcamountD0=number_format($fcamountD0,2);
            
            $strAutoNumber0="
               var gContainer=window.opener;              
//               alert(gContainer.document.getElementById('fnindex_grid0').value);
               
             
                   gContainer.document.getElementById('fcincome_amountD0'+gContainer.document.getElementById('fnindex_grid0').value).value='{$fcincome_amountD0}';
                   gContainer.document.getElementById('fcdeduction_amountD0'+gContainer.document.getElementById('fnindex_grid0').value).value='{$fcdeduction_amountD0}';
                   gContainer.document.getElementById('fcamountD0'+gContainer.document.getElementById('fnindex_grid0').value).value='{$fcamountD0}';
//                   ElementCurrencyOnBlur(document.getElementById('fcincome_amountD0'+gContainer.document.getElementById('fnindex_grid0').value));
//                   ElementCurrencyOnBlur(document.getElementById('fcdeduction_amountD0'+gContainer.document.getElementById('fnindex_grid0').value));
//                   ElementCurrencyOnBlur(document.getElementById('fcamountD0'+gContainer.document.getElementById('fnindex_grid0').value));

              

            ";



$objAxpDB->FormJS($strAutoNumber0);
        
	$objAxpDB->ViewName("Daftar Slip Gaji Tipe 1");
	$objAxpDB->ViewSQL("SELECT a.fnid, a.ftpayroll_slip_no, a.fdtrans_date
                            FROM txpayroll_slip_hdr a 
                            WHERE a.fnsalary_type=0
                            order by a.ftpayroll_slip_no desc, a.fdtrans_date desc");
    $objAxpDB->ViewCaption("ID, No. Slip Gaji,
                                 Tgl. Transaksi");

    $objAxpDB->FormName("Perhitungan Tunjangan Tambahan");
	$objAxpDB->FormSQL("SELECT ftpayroll_slip_no, ftemployee_code FROM txpayroll_slip_emp");
	$objAxpDB->FormCaption("No. Slip Gaji, Karyawan");
	$objAxpDB->FormPosition("TL, TR");
	$objAxpDB->ViewPeriod(False);
	$objAxpDB->FormName("Slip Gaji Tipe 1");	
	$objAxpDB->GridName(0, "Daftar Pendapatan");
	$objAxpDB->GridSQL(0, "select fnindex, ftsalary_code,fcamount from txpayroll_slip_inc_plus $where  ");
	$objAxpDB->GridCaption(0, "No., Nama Gaji, Jumlah  ");
	$objAxpDB->GridHidden(0,"0,0,0,1");
    $objAxpDB->ButtonShow("simpan");
    $objAxpDB->FormLocked("1, 1");
    $objAxpDB->GridLocked(0, "1, 1, 0");

	 $objAxpDB->Process();
    $objAxpDB->WriteHtmlTable();


?>