<?
/* index.php: $pubmodule, $pubtask, $pubitemid */
/*
$pubsubjectid = $_REQUEST["subjectid"];
$pubtypeid = $_REQUEST["typeid"];
$pubgroupid = $_REQUEST["groupid"];
*/
$pubsupplierid = $_REQUEST["sid"];

$pubpageno = $_REQUEST['pageno'];
if ($pubpageno=="") $pubpageno=1;

// filter forms..
$filtersuppliername=$_POST['suppliername'];
$filterapprovedstatus=$_POST['approvedstatus'];
$filteractivestatus=$_POST['activestatus'];
$filtersuppliernob=$_POST['suppliernob'];
?>

<script type="text/javascript">

// ................................................................................
// user-interaction handlers..
// ................................................................................

function supplier_button_search() {
  document.supplierform.job.value='supplier_search';
  document.supplierform.submit();
}

function supplier_button_add() {
  document.location='index.php?module=supplier&task=add';
}

function supplier_button_edit(supplierpkey) {
  document.location='index.php?module=supplier&task=edit&itemid='+supplierpkey;
}

//yusr
function supplier_button_deactive(supplierkey){
if (confirm("Are you sure de-active this supplier?")) {
    document.location='index.php?module=supplier&task=deactivate&itemid='+supplierpkey;
  }
}

function supplier_button_view(supplierpkey) {
  document.location='index.php?module=supplier&task=view&itemid='+supplierpkey;
}

function supplier_button_delete(supplierpkey) {
  document.location='index.php?module=supplier&task=delete&itemid='+supplierpkey;
}

function supplier_button_addbg(supplierpkey) {
  document.location='index.php?module=supplier&task=addbg&sid='+supplierpkey;
}

function supplier_button_editbg(supplierpkey,bgpkey) {
  document.location='index.php?module=supplier&task=editbg&sid='+supplierpkey+'&itemid='+bgpkey;
}

function supplier_button_viewbg(supplierpkey,bgpkey) {
  document.location='index.php?module=supplier&task=viewbg&sid='+supplierpkey+'&itemid='+bgpkey;
}

function supplier_button_deletebg(supplierpkey,bgpkey) {
  document.location='index.php?module=supplier&task=deletebg&sid='+supplierpkey+'&itemid='+bgpkey;
}

function supplier_button_recommend(supplierpkey) {
  if (confirm("Are you sure to recommend this supplier?")) {
    document.location='index.php?module=supplier&task=recommend&itemid='+supplierpkey;
  }
}

function supplier_button_approve(supplierpkey) {
  if (confirm("Are you sure to approve this supplier?")) {
    document.location='index.php?module=supplier&task=approve&itemid='+supplierpkey;
  }
}

function supplier_button_activate(supplierpkey) {
  if (confirm("Are you sure to change this supplier's status to Active?")) {
    document.location='index.php?module=supplier&task=activate&itemid='+supplierpkey;
  }
}

function supplier_button_deactivate(supplierpkey) {
  if (confirm("Are you sure to change this supplier's status to Inactive?")) {
    document.location='index.php?module=supplier&task=deactivate&itemid='+supplierpkey;
  }
}
function supplier_button_deactivate2(supplierpkey) {
  if (confirm("Are you sure want to deactivate this supplier?")) {
    document.location='index.php?module=supplier&task=deactivate2&itemid='+supplierpkey;
  }
}
function supplier_button_save() {	//(accesslevel,userrole) {
  if (validateForm()==true) {		//accesslevel,userrole)==true) {
    document.supplierform.job.value='supplier_add'; document.supplierform.submit();
  }
}

function supplier_button_update() {
  if (validateForm()==true) {
    document.supplierform.job.value='supplier_edit'; document.supplierform.submit();
  }
}

function supplier_button_purge() {
  document.supplierform.job.value='supplier_remove'; document.supplierform.submit();
}

function supplier_button_savebg() {
  if (validateForm()==true) {
    document.supplierform.job.value='supplier_bgadd'; document.supplierform.submit();
  }
}

function supplier_button_updatebg() {
  if (validateForm()==true) {
    document.supplierform.job.value='supplier_bgedit'; document.supplierform.submit();
  }
}

function supplier_button_purgebg() {
  document.supplierform.job.value='supplier_bgremove'; document.supplierform.submit();
}

function supplier_button_printlist() {
	/* myapit uncomment 1st line, comment 2nd line*/
	// window.open('views/rpt_supplierlist.php','printwindow', 'menubar=0,toolbar=0,scrollbars=1,resizable=0,location=0,width=1024,height=760');
 document.supplierform.submit();
}

function supplier_button_backtolist() {
  document.location='index.php?module=supplier&task=main';
}

function supplier_button_back() {
  history.go(-1);
}

</script>

<?

// ................................................................................
// model..
// ................................................................................

include_once('models/supplierModel.php');
$mysupplierModel=new supplierModel;

?>

<?

// ................................................................................
// default to list view if none specified..
// ................................................................................
if ($pubtask=="") $pubtask="main";

// ................................................................................
// display page header..
// ................................................................................

$pagetitle="Master Data";
if (($pubtask=="main")||($pubtask=="submenu")) {
  $subtitle="Suppliers List";
} else if ($pubtask=="view") {
  $subtitle="Supplier Information";
} else if ($pubtask=="add") {
  $subtitle="Add Supplier";
} else if ($pubtask=="edit") {
  $subtitle="Edit Supplier";
} else if ($pubtask=="delete") {
  $subtitle="Delete Supplier";
} else if ($pubtask=="listbg") {
  $subtitle="Bank Guarantees";
} else if ($pubtask=="viewbg") {
  $subtitle="Bank Guarantee Information";
} else if ($pubtask=="addbg") {
  $subtitle="Add Bank Guarantee";
} else if ($pubtask=="editbg") {
  $subtitle="Edit Bank Guarantee";
} else if ($pubtask=="deletebg") {
  $subtitle="Delete Bank Guarantee";
} else if ($pubtask=="approvals") {
  $subtitle="Supplier Approval History";
} else if ($pubtask=="recommend") {
  $subtitle="Recommend Supplier";
} else if ($pubtask=="approve") {
  $subtitle="Approve Supplier";
} else if ($pubtask=="activate") {
  $subtitle="Activate Supplier";
} else if ($pubtask=="deactivate") {
  $subtitle="Deactivate Supplier";
} else {
  $subtitle="Error: Invalid Option";
}

$headercaption=$pagetitle." --> ".$subtitle;
include_once('header.php');

include_once('views/general-header.tpl');


// TODO: Later to show list of available variables here if in DEBUG mode!!

// ................................................................................
// display main area..
// ................................................................................

if (($pubtask=="main")||($pubtask=="submenu")) {

  # myapit - fix no 5
  #$supplier_list = $mysupplierModel->getlist_suppliers("supplier_regdate","ASC",$filtersuppliername,$filterapprovedstatus,$filteractivestatus,$filtersuppliernob);
  $supplier_list = $mysupplierModel->getlist_suppliers("supplier_regid","DESC",$filtersuppliername,$filterapprovedstatus,$filteractivestatus,$filtersuppliernob);
  $cindex=0;
  foreach ($supplier_list as $mysupp) {
    $approval_list[$cindex] = $mysupplierModel->getlist_approvals($mysupp['supplier_pkey']);
    $bg_list[$cindex] = $mysupplierModel->getlist_bankguarantees($mysupp['supplier_pkey']);
    $expfound=false;
    $bgtotal[$cindex]['bg_banktotal']=0;
    foreach ($bg_list[$cindex] as $mybg) {
      $bgtotal[$cindex]['bg_expired']=false;
      $bgtotal[$cindex]['bg_banktotal']=$bgtotal[$cindex]['bg_banktotal']+$mybg['bg_bankamount'];
      if (($mybg['bg_enddate']-5184000)<=getdatestamp()) {
        $expfound=true;
        $bgtotal[$cindex]['bg_expired']=true;
        if ($mybg['bg_enddate']<=getdatestamp()) {
          $bgtotal[$cindex]['bg_fullremarks']=$bgtotal[$cindex]['bg_fullremarks']."<font color='#ff0000'><b>".unconverttounixslash($mybg['bg_startdate'])." - ".unconverttounixslash($mybg['bg_enddate'])." ".$mybg['bg_projectname']." ".($mybg['bg_bankamount']/1000)."K</b></font>&nbsp;<img src='gfx/gifs/alert2.gif' border=0 title='Expired' alt='Expired'>, ";
        } else {
          $bgtotal[$cindex]['bg_fullremarks']=$bgtotal[$cindex]['bg_fullremarks']."<font color='#ff0000'><b>".unconverttounixslash($mybg['bg_startdate'])." - ".unconverttounixslash($mybg['bg_enddate'])." ".$mybg['bg_projectname']." ".($mybg['bg_bankamount']/1000)."K</b></font>&nbsp;<img src='gfx/gifs/alert2.gif' border=0 title='Expiring' alt='Expiring'>, ";
        }
      } else {
        $bgtotal[$cindex]['bg_expired']=false;
        $bgtotal[$cindex]['bg_fullremarks']=$bgtotal[$cindex]['bg_fullremarks'].unconverttounixslash($mybg['bg_startdate'])." - ".unconverttounixslash($mybg['bg_enddate'])." ".$mybg['bg_projectname']." ".($mybg['bg_bankamount']/1000)."K, ";
      }
    }
    $bgtotal[$cindex]['bg_fulltotal']=($bgtotal[$cindex]['bg_banktotal']*$mysupp['supplier_bgratio'])+$mysupp['supplier_personalamount'];
    if ($expfound==true_) {
      $bgtotal[$cindex]['bg_fullremarks']=substr($bgtotal[$cindex]['bg_fullremarks'],0,strlen($bgtotal[$cindex]['bg_fullremarks'])-2);
    } else {
      $bgtotal[$cindex]['bg_fullremarks']=substr($bgtotal[$cindex]['bg_fullremarks'],0,strlen($bgtotal[$cindex]['bg_fullremarks'])-2);
    }
    $cindex++;
  }
  include_once('views/supplier-list.tpl');

} else if ((($pubtask=="add")||($pubtask=="edit"))&&(($pubuseraccess['access_supplier_edit']==1)||($pubuserrole>=2))) {

  $supplier_data = $mysupplierModel->getdata_supplier($pubitemid);
  if ($supplier_data['supplier_regdate']=="") {
    $supplier_data['supplier_regdate']=gettimestamp();
    $supplier_data['supplier_bgratio']="1";
  }

  // new: bg & contact info
  $bg_list = $mysupplierModel->getlist_bankguarantees($pubitemid);
  $contact_list = $mysupplierModel->getlist_contacts($pubitemid);

  include_once('views/supplier-edit.tpl');

} else if ($pubtask=="view") {

  $supplier_data = $mysupplierModel->getdata_supplier($pubitemid);
  $approval_data = $mysupplierModel->getdata_lastapproval($pubitemid);

  // new: bg & contact info
  $bg_list = $mysupplierModel->getlist_bankguarantees($pubitemid);
  $contact_list = $mysupplierModel->getlist_contacts($pubitemid);

  include_once('views/supplier-view.tpl');

} else if (($pubtask=="delete")&&(($pubuseraccess['access_supplier_edit']==1)||($pubuserrole>=2))) {

  $supplier_data = $mysupplierModel->getdata_supplier($pubitemid);

  // new: bg & contact info
  $bg_list = $mysupplierModel->getlist_bankguarantees($pubitemid);
  $contact_list = $mysupplierModel->getlist_contacts($pubitemid);

  include_once('views/supplier-view.tpl');

} else if ($pubtask=="listbg") {

  $bg_list = $mysupplierModel->getlist_bankguarantees($pubitemid);
  $supplier_data = $mysupplierModel->getdata_supplier($pubitemid);
  include_once('views/supplier-listbg.tpl');

} else if ((($pubtask=="addbg")||($pubtask=="editbg"))&&(($pubuseraccess['access_supplier_edit']==1)||($pubuserrole>=2))) {

  $bg_data = $mysupplierModel->getdata_bankguarantee($pubitemid,$pubsupplierid);
  if ($pubtask=="addbg") $bg_data['bg_supplierpkey']=$pubsupplierid;
  include_once('views/supplier-editbg.tpl');

} else if ($pubtask=="viewbg") {

  $bg_data = $mysupplierModel->getdata_bankguarantee($pubitemid,$pubsupplierid);
  include_once('views/supplier-viewbg.tpl');

} else if ($pubtask=="deletebg") {

  $bg_data = $mysupplierModel->getdata_bankguarantee($pubitemid,$pubsupplierid);
  include_once('views/supplier-viewbg.tpl');

} else if ($pubtask=="approvals") {

  $supplier_data = $mysupplierModel->getdata_supplier($pubitemid);
  $approval_list = $mysupplierModel->getlist_approvals($pubitemid);
  include_once('views/supplier-approvals.tpl');

} else if ($pubtask=="recommend") {

  /* POTENTITAL ISSUE: IF USER CLICKS BACK, MULTIPLE APPROVALS WILL BE INSERTED!!!!! */

  include_once('models/userModel.php');
  $myuserModel=new userModel;

  $user_data = $myuserModel->getdata_user($_SESSION['Xuserpkey']);
  $opresult = $mysupplierModel->insertdata_approval('', $pubitemid, 1, $_SESSION['Xuserpkey'], $user_data['staff_name'], unconverttounixfull(gettimestamp()), 1, '');
  $g=goto('index.php?module=supplier&task=view&itemid='.$pubitemid);
  echo $g;
  exit;

} else if ($pubtask=="approve") {

  include_once('models/userModel.php');
  $myuserModel=new userModel;

  $user_data = $myuserModel->getdata_user($_SESSION['Xuserpkey']);
  $opresult = $mysupplierModel->insertdata_approval('', $pubitemid, 2, $_SESSION['Xuserpkey'], $user_data['staff_name'], unconverttounixfull(gettimestamp()), 1, '');
  $g=goto('index.php?module=supplier&task=view&itemid='.$pubitemid);
  echo $g;
  exit;

} else if ($pubtask=="activate") {

  $opresult = $mysupplierModel->updatedata_status($pubitemid, 1);
  $g=goto('index.php?module=supplier&task=view&itemid='.$pubitemid);
  echo $g;
  exit;

} else if ($pubtask=="deactivate") {

  $opresult = $mysupplierModel->updatedata_status($pubitemid, 2);
  $g=goto('index.php?module=supplier&task=view&itemid='.$pubitemid);
  echo $g;
  exit;
} else if ($pubtask=="deactivate2") { // in-active yusr

  $opresult = $mysupplierModel->updatedata_status($pubitemid, 0); // de-active
  $g=goto('index.php?module=supplier&task=view&itemid='.$pubitemid);
  echo $g;
  exit;
} else {
  include_once('views/general-invalidtask.php');
}

// ...............................................................................
// display button options area..
// ...............................................................................

$prevurl = explode('/',$_SESSION['Xpreviousurl']);
$prevfile = $prevurl[count($prevurl)-1];
if ($prevfile=='inputController.php') $backstatus="style='display: none;'";

echo "<br>";

if (($pubtask=="main")||($pubtask=="submenu")) {

  echo "<br><hr size=1>";
  if (($pubuseraccess['access_supplier_edit']==1)||($pubuserrole>=2)) {
    echo "<button name=\"add\" id=\"add\" onClick=\"supplier_button_add();\"><img src='gfx/options/b_add.png' class='actionbutton'>&nbsp;&nbsp;Add New Supplier</button>&nbsp;";
  }
  // later only allow print once approved? probably..
  echo "<button name=\"print\" id=\"print\" onClick=\"supplier_button_printlist();\">&nbsp;<img src='gfx/options/b_print1.png' class='actionbutton'>&nbsp;&nbsp;Print&nbsp;</button>&nbsp;";
  echo "<button name=\"back\" id=\"back\" ".$backstatus." onClick=\"supplier_button_back();\">&nbsp;<img src='gfx/options/b_back.png' class='actionbutton'>&nbsp;&nbsp;Back&nbsp;</button>&nbsp;";
  echo "<br><hr size=1><br>";

} else if (($pubtask=="add")&&(($pubuseraccess['access_supplier_edit']==1)||($pubuserrole>=2))) {

  echo "<br><hr size=1>";
  if (($pubuseraccess['access_supplier_edit']==1)||($pubuserrole>=2)) {
    echo "<button name=\"save\" id=\"save\" onClick=\"supplier_button_save();\"><img src='gfx/options/b_save.png' class='actionbutton'>&nbsp;&nbsp;Save Supplier</button>&nbsp;";
  }
  echo "<button name=\"cancel\" id=\"cancel\" onClick=\"supplier_button_back();\"><img src='gfx/options/b_cancel.png' class='actionbutton'>&nbsp;&nbsp;Cancel</button>&nbsp;";
  echo "<br><hr size=1><br>";

} else if (($pubtask=="edit")&&(($pubuseraccess['access_supplier_edit']==1)||($pubuserrole>=2))) {

  echo "<br><hr size=1>";
  if (($pubuseraccess['access_supplier_edit']==1)||($pubuserrole>=2)) {
    echo "<button name=\"update\" id=\"update\" onClick=\"supplier_button_update();\"><img src='gfx/options/b_save.png' class='actionbutton'>&nbsp;&nbsp;Update Supplier</button>&nbsp;";
  }
  echo "<button name=\"cancel\" id=\"cancel\" onClick=\"supplier_button_back();\"><img src='gfx/options/b_cancel.png' class='actionbutton'>&nbsp;&nbsp;Cancel</button>&nbsp;";
  echo "<br><hr size=1><br>";

} else if ($pubtask=="view") {

  echo "<br><hr size=1>";
  if ($approval_data['approval_type']==1) {
    if ($pubuseraccess['access_supplier_approve']==1) {
      echo "<button name=\"approve\" id=\"approve\" onClick=\"supplier_button_approve('".$pubitemid."');\"><img src='gfx/options/b_edit.png' class='actionbutton'>&nbsp;&nbsp;Approve</button>&nbsp;";
    }
  } else if ($approval_data['approval_type']!=2) {
    if ($pubuseraccess['access_supplier_recommend']==1) {
      echo "<button name=\"recommend\" id=\"recommend\" onClick=\"supplier_button_recommend('".$pubitemid."');\"><img src='gfx/options/b_edit.png' class='actionbutton'>&nbsp;&nbsp;Recommend</button>&nbsp;";
    }
  }
  if ($supplier_data['supplier_status']==1) {
    if ($pubuseraccess['access_supplier_activate']==1) {
      echo "<button name=\"deactivate\" id=\"deactivate\" onClick=\"supplier_button_deactivate('".$pubitemid."');\"><img src='gfx/options/b_edit.png' class='actionbutton'>&nbsp;&nbsp;Blacklist</button>&nbsp;";
    }
  } else if ($supplier_data['supplier_status']==2) {
    if ($pubuseraccess['access_supplier_activate']==1) {
      echo "<button name=\"activate\" id=\"activate\" onClick=\"supplier_button_activate('".$pubitemid."');\"><img src='gfx/options/b_edit.png' class='actionbutton'>&nbsp;&nbsp;&nbsp;Unblacklist</button>&nbsp;";
    }
  }
  if ($pubuseraccess['access_supplier_edit']==1) {
    if ($supplier_data['supplier_status']==0){
	echo "<button name=\"xxx\" id=\"edit\" onClick=\"supplier_button_activate('".$pubitemid."');\">&nbsp;<img src='gfx/options/b_edit.png' class='actionbutton'>&nbsp;&nbsp;Activated&nbsp;</button>&nbsp;";
	}else{
    echo "<button name=\"xxx\" id=\"edit\" onClick=\"supplier_button_deactivate2('".$pubitemid."');\">&nbsp;<img src='gfx/options/b_edit.png' class='actionbutton'>&nbsp;&nbsp;De-active&nbsp;</button>&nbsp;";
    }
	echo "<button name=\"edit\" id=\"edit\" onClick=\"supplier_button_edit('".$pubitemid."');\">&nbsp;<img src='gfx/options/b_edit.png' class='actionbutton'>&nbsp;&nbsp;Edit&nbsp;</button>&nbsp;";
    echo "<button name=\"delete\" id=\"delete\" onClick=\"supplier_button_delete('".$pubitemid."');\"><img src='gfx/options/b_drop.png' class='actionbutton'>&nbsp;&nbsp;Delete</button>&nbsp;";
  }
  echo "<button name=\"back\" id=\"back\" onClick=\"supplier_button_backtolist();\">&nbsp;<img src='gfx/options/b_back.png' class='actionbutton'>&nbsp;&nbsp;Back to Suppliers List&nbsp;</button>&nbsp;";
  echo "<br><hr size=1><br>";

} else if (($pubtask=="delete")&&(($pubuseraccess['access_supplier_edit']==1)||($pubuserrole>=2))) {

  echo "<br><hr size=1>";
  if (($pubuseraccess['access_supplier_edit']==1)||($pubuserrole>=2)) {
    echo "<font color='#ff0000'><b>ARE YOU SURE TO PERMANENTLY DELETE THIS SUPPLIER?</b></font><br><br>";
    echo "<button name=\"delete\" id=\"delete\" onClick=\"supplier_button_purge();\">&nbsp;Yes, Delete Supplier&nbsp;</button>&nbsp;";
  }
  echo "<button name=\"cancel\" id=\"cancel\" onClick=\"supplier_button_back();\"><img src='gfx/options/b_cancel.png' class='actionbutton'>&nbsp;&nbsp;Cancel</button>&nbsp;";
  echo "<brp><hr size=1><br>";

} else if ($pubtask=="listbg") {

  echo "<br><hr size=1>";
  //echo "<button name=\"print\" id=\"print\" onClick=\"supplier_button_printlist();\">&nbsp;<img src='gfx/options/b_print1.png' class='actionbutton'>&nbsp;&nbsp;Print&nbsp;</button>&nbsp;";
  if ($pubuseraccess['access_supplier_edit']==1) {
    echo "<button name=\"add\" id=\"add\" onClick=\"supplier_button_addbg('".$pubitemid."');\"><img src='gfx/options/b_add.png' class='actionbutton'>&nbsp;&nbsp;Add New Bank Guarantee</button>&nbsp;";
  }
  echo "<button name=\"back\" id=\"back\" ".$backstatus." onClick=\"supplier_button_back();\">&nbsp;<img src='gfx/options/b_back.png' class='actionbutton'>&nbsp;&nbsp;Back&nbsp;</button>&nbsp;";
  echo "<br><hr size=1><br>";

} else if (($pubtask=="addbg")&&(($pubuseraccess['access_supplier_edit']==1)||($pubuserrole>=2))) {

  echo "<br><hr size=1>";
  echo "<button name=\"save\" id=\"save\" onClick=\"supplier_button_savebg();\"><img src='gfx/options/b_save.png' class='actionbutton'>&nbsp;&nbsp;Save Bank Guarantee</button>&nbsp;";
  echo "<button name=\"cancel\" id=\"cancel\" onClick=\"supplier_button_back();\"><img src='gfx/options/b_cancel.png' class='actionbutton'>&nbsp;&nbsp;Cancel</button>&nbsp;";
  echo "<br><hr size=1><br>";

} else if (($pubtask=="editbg")&&(($pubuseraccess['access_supplier_edit']==1)||($pubuserrole>=2))) {

  echo "<br><hr size=1>";
  echo "<button name=\"update\" id=\"update\" onClick=\"supplier_button_updatebg();\"><img src='gfx/options/b_save.png' class='actionbutton'>&nbsp;&nbsp;Update Bank Guarantee</button>&nbsp;";
  echo "<button name=\"cancel\" id=\"cancel\" onClick=\"supplier_button_back();\"><img src='gfx/options/b_cancel.png' class='actionbutton'>&nbsp;&nbsp;Cancel</button>&nbsp;";
  echo "<br><hr size=1><br>";

} else if ($pubtask=="viewbg") {

  echo "<br><hr size=1>";
  if ($pubuseraccess['access_supplier_edit']==1) {
    echo "<button name=\"edit\" id=\"edit\" onClick=\"supplier_button_editbg('".$pubsupplierid."','".$pubitemid."');\">&nbsp;<img src='gfx/options/b_edit.png' class='actionbutton'>&nbsp;&nbsp;Edit&nbsp;</button>&nbsp;";
    echo "<button name=\"delete\" id=\"delete\" onClick=\"supplier_button_deletebg('".$pubsupplierid."','".$pubitemid."');\"><img src='gfx/options/b_drop.png' class='actionbutton'>&nbsp;&nbsp;Delete</button>&nbsp;";
  }
  echo "<button name=\"back\" id=\"back\" ".$backstatus." onClick=\"supplier_button_back();\">&nbsp;<img src='gfx/options/b_back.png' class='actionbutton'>&nbsp;&nbsp;Back&nbsp;</button>&nbsp;";
  echo "<br><hr size=1><br>";

} else if ($pubtask=="deletebg") {

  echo "<br><hr size=1>";
  echo "<font color='#ff0000'><b>ARE YOU SURE TO PERMANENTLY DELETE THIS BANK GUARANTEE?</b></font><br><br>";
  echo "<button name=\"delete\" id=\"delete\" onClick=\"supplier_button_purgebg();\">&nbsp;Yes, Delete Bank Guarantee&nbsp;</button>&nbsp;";
  echo "<button name=\"cancel\" id=\"cancel\" onClick=\"supplier_button_back();\"><img src='gfx/options/b_cancel.png' class='actionbutton'>&nbsp;&nbsp;Cancel</button>&nbsp;";
  echo "<brp><hr size=1><br>";

} else if ($pubtask=="approvals") {

  echo "<br><hr size=1>";
  echo "<button name=\"back\" id=\"back\" ".$backstatus." onClick=\"supplier_button_back();\">&nbsp;<img src='gfx/options/b_back.png' class='actionbutton'>&nbsp;&nbsp;Back&nbsp;</button>&nbsp;";
  echo "<br><hr size=1><br>";

}

// ................................................................................
// display page footer..
// ................................................................................

include_once('views/general-footer.tpl');

?>
