Location: PHPKode > projects > Bcom > bcom-1.99.1/bcom/include/crmform_site.inc
<?
/*
 Name: site crmform
 Filename: crmform_site.inc 
 Author(s):  Jeroen Houben, Tim Gunn
 Version: 2.0.0
 Purpose:
 	Site client edit form for CRM site clients.
*/

require_once('lib/liborder.inc');
require_once('lib/libpayment.inc');

print '
<SCRIPT LANGUAGE="JavaScript">
<!--//

function copyaddress()
{
	clientform.elements[\'details[s_firstname]\'].value = clientform.elements[\'firstname\'].value;
	clientform.elements[\'details[s_lastname]\'].value = clientform.elements[\'lastname\'].value;
	clientform.elements[\'details[s_address]\'].value = clientform.elements[\'details[address]\'].value;
	clientform.elements[\'details[s_address2]\'].value = clientform.elements[\'details[address2]\'].value;
	clientform.elements[\'details[s_suburb]\'].value = clientform.elements[\'details[suburb]\'].value;
	clientform.elements[\'details[s_state]\'].value = clientform.elements[\'details[state]\'].value;
	clientform.elements[\'details[s_postcode]\'].value = clientform.elements[\'details[postcode]\'].value;
	clientform.elements[\'details[s_country]\'].options[clientform.elements[\'details[country]\'].selectedIndex].selected = true; 
}
//-->
</SCRIPT>
<table width="100%"> 
<tr>
	<td valign="top">
	<TABLE WIDTH="100%" cellpadding="2" cellspacing="2" border="0">
		<TR>
		<TH colspan="2">'.$SECTIONS[$clienttype]['client']['description'].'</TH>
		</TR>
		<TR>
		<TD class="bar2" width="20%">'.LL('gen-group').'</TD>
		<TD class="bar1" width="80%"><A HREF="javascript:bopenwindow(\'clientmanager.php?action=movetogroup&clientid='.$clientid.'&uinotitle=1\',\'MoveClient\',\'400,300\')">'.group_getname($client['c_group']).'</A></td>
		</TR>
		<TR>
		<TD class="bar2" width="20%">'.LL('crm-firstname').'</TD>
		<TD class="bar1" width="80%">'.ui_textbox('firstname',client_getval($clientid,'firstname'),35).'</TD>
		</TR>
		<TR>
		<TD class="bar2" width="20%">'.LL('crm-lastname').'</TD>
		<TD class="bar1" width="80%">'.ui_textbox('lastname',client_getval($clientid,'lastname'),35).'</TD>
		</TR>
		<TR>
		<TD class="bar2" width="20%">'.LL('crm-address').'</TD>
		<TD class="bar1" width="80%">'.ui_textbox('details[address]',client_getval($clientid,'address'),30).'</td>
		</TR>
		<TD class="bar2" width="20%">'.LL('crm-address').' 2</TD>
		<TD class="bar1" width="80%">'.ui_textbox('details[address2]',client_getval($clientid,'address2'),30).'</td>
		</TR>
		<TR>
		<TD class="bar2" width="20%">'.LL('crm-suburb').'</TD>
		<TD class="bar1" width="80%">'.ui_textbox('details[suburb]',client_getval($clientid,'suburb'),30).'</TD>
		</TR>
		<TR>
		<TD class="bar2" width="20%">'.LL('crm-postcode').'</TD>
		<TD class="bar1" width="80%">'.ui_textbox('details[postcode]',client_getval($clientid,'postcode'),6,8).'
		'.LL('crm-state').' '.ui_textbox('details[state]',client_getval($clientid,'state'),3,4).'
		</TD>
		</TR>
		<TR>
		<TD class="bar2" width="20%">'.LL('crm-country').'</TD>
		<TD class="bar1" width="80%">
		'.ui_selectbox('details[country]',unserialize(getoption('locale','countries')),client_getval($clientid,'country','AU')).'
		</SELECT>
		</TD>
		</TR>
		<TR>
		<TD class="bar2" width="20%">'.LL('crm-areacode').'</TD>
		<TD class="bar1" width="80%">'.ui_textbox('details[areacode]',client_getval($clientid,'areacode'),3,3).'</TD>
		</TR>
		<TR>
		<TD class="bar2" width="20%">'.LL('crm-phone').'</TD>
		<TD class="bar1" width="80%">'.ui_textbox('details[phone]',client_getval($clientid,'phone'),8,15).'</TD>
		</TR>
		<TR>
		<TD class="bar2" width="20%">'.LL('crm-fax').'</TD>
		<TD class="bar1" width="80%">'.ui_textbox('details[fax]',client_getval($clientid,'fax'),8,15).'</TD>
		</TR>
		<TR>
		<TD WIDTH="20%" CLASS=bar2>'.LL('crm-email').'</TD> 
		<TD WIDTH="80%" CLASS=bar1>'.ui_textbox('details[email]',client_getval($clientid,'email'),30).'&nbsp;&nbsp;&nbsp;<A HREF="usermsg.php?display=compose&email[to]='.client_getval($clientid,'email').'">send e-mail</A></TD>
		</TR>';
		print showcustomfields('client');
		print '
	</TABLE>
	</td>
	<td valign="top">
	<TABLE WIDTH="100%" cellpadding="2" cellspacing="2" border="0">
		<TR>
		<TH colspan="2">
		<table width="100%" cellpadding="0" cellspacing="0">
		<tr>
			<th align="left">'.$SECTIONS[$clienttype]['shipping']['description'].'</th>
			<th align="right"><div align="right">'.getbutton('copy-address','javascript:copyaddress();').'</div></th>
		</tr>
		</table>
		</TH>
		</TR>
		<TR>
		<TD class="bar2" width="20%">'.LL('crm-firstname').'</TD>
		<TD class="bar1" width="80%">'.ui_textbox('details[s_firstname]',client_getval($clientid,'s_firstname'),35).'</TD>
		</TR>
		<TR>
		<TD class="bar2" width="20%">'.LL('crm-lastname').'</TD>
		<TD class="bar1" width="80%">'.ui_textbox('details[s_lastname]',client_getval($clientid,'s_lastname'),35).'</TD>
		</TR>
		<TR>
		<TD class="bar2" width="20%">'.LL('crm-address').'</TD>
		<TD class="bar1" width="80%">'.ui_textbox('details[s_address]',client_getval($clientid,'s_address'),30).'</td>
		</TR>
		<TD class="bar2" width="20%">'.LL('crm-address').' 2</TD>
		<TD class="bar1" width="80%">'.ui_textbox('details[s_address2]',client_getval($clientid,'s_address2'),30).'</td>
		</TR>
		<TR>
		<TD class="bar2" width="20%">'.LL('crm-suburb').'</TD>
		<TD class="bar1" width="80%">'.ui_textbox('details[s_suburb]',client_getval($clientid,'s_suburb'),30).'</TD>
		</TR>
		<TR>
		<TD class="bar2" width="20%">'.LL('crm-postcode').'</TD>
		<TD class="bar1" width="80%">'.ui_textbox('details[s_postcode]',client_getval($clientid,'s_postcode'),6,8).'
		'.LL('crm-state').' '.ui_textbox('details[s_state]',client_getval($clientid,'s_state'),6,8).'
		</TD>
		</TR>
		<TR>
		<TD class="bar2" width="20%">'.LL('crm-country').'</TD>
		<TD class="bar1" width="80%">
		'.ui_selectbox('details[s_country]',unserialize(getoption('locale','countries')),client_getval($clientid,'s_country','AU')).'
		</TD>
		</TR>';
		print showcustomfields('shipping');
		print '
			<TABLE WIDTH="100%" cellpadding="2" cellspacing="2" border="0">
		<TR>
		<TH colspan="3">'.LL($SECTIONS[$clienttype]['orders']['description']).'</TH>
		</TR>';
			$result = bsql_query('SELECT a.o_id,b.o_value FROM orders a, orders b
			WHERE a.o_id = b.o_id and a.o_field = \'clientid\'
			AND a.o_value = \''.$clientid.'\' and b.o_field = \'m_date\' ORDER BY b.o_value LIMIT 10') or sdie();
			
			$ORD = new order();
			print '<TR><TD CLASS="bar1"><B>Order No:</B></TD><TD CLASS="bar1"><B>Status</B></TD><TD CLASS="bar1"><B>Total Price</B></TD></TR>';
			$bar = 1;
			while($row = bsql_getrow($result)) {
				$ORD->loadorder($row[0]);
				if($bar == 1) { $bar = 2; } else { $bar = 1; }
				$details = $ORD->getdetails();
				print '<TR>
				<TD CLASS="bar'.$bar.'"><A HREF="javascript:bopenwindow(\'ordermanager.php?action=openorder&mode=close&orderid='.$row[0].'\',\'order\',700,500);">Order No: '.$row[0].'</A></TD>
				<TD CLASS="bar'.$bar.'">'.$ORD->getval('status').'</TD>
				<TD CLASS="bar'.$bar.'">'.cur_formatamount($details['sumprice']).'</TD></TR>';
			}
		print '</TABLE>
	</td>
</tr>
</table>';
?>
Return current item: Bcom