- modules/fotolab updated imagej to current version & some cod fixes to make it work
[care2x.git] / Care2007 / modules / insurance_co / insurance_co_new.php
blob7e614d59a99dbae24d777d322ebe5632420f4277
1 <?php
2 error_reporting(E_COMPILE_ERROR|E_ERROR|E_CORE_ERROR);
3 require('./roots.php');
4 require($root_path.'include/inc_environment_global.php');
5 /**
6 * CARE2X Integrated Hospital Information System Deployment 2.2 - 2006-07-10
7 * GNU General Public License
8 * Copyright 2002,2003,2004,2005,2006 Elpidio Latorilla
9 * elpidio@care2x.org,
11 * See the file "copy_notice.txt" for the licence notice
13 define('LANG_FILE','finance.php');
14 $local_user='aufnahme_user';
15 require_once($root_path.'include/inc_front_chain_lang.php');
16 /* Load the insurance object */
17 require_once($root_path.'include/care_api_classes/class_insurance.php');
18 $ins_obj=new Insurance;
20 //$db->debug=1;
22 switch($retpath)
24 case 'list': $breakfile='insurance_co_list.php'.URL_APPEND; break;
25 case 'search': $breakfile='insurance_co_search.php'.URL_APPEND; break;
26 default: $breakfile='insurance_co_manage.php'.URL_APPEND;
29 if(!isset($mode)){
30 $mode='';
31 $edit=true;
32 }else{
33 switch($mode)
35 case 'save':
37 //$db->debug=true;
38 /* Validate important data */
39 $HTTP_POST_VARS['firm_id']=trim($HTTP_POST_VARS['firm_id']);
40 $HTTP_POST_VARS['name']=trim($HTTP_POST_VARS['name']);
41 if(!(empty($HTTP_POST_VARS['firm_id'])||empty($HTTP_POST_VARS['name']))){
43 # Check if insurance ID exists
44 if($ins_obj->FirmIDExists($HTTP_POST_VARS['firm_id'])){
46 # Notify
47 $mode='firm_exists';
49 }else{
50 if($ins_obj->saveFirmInfoFromArray($HTTP_POST_VARS)){
51 header("location:insurance_co_info.php?sid=$sid&lang=$lang&firm_id=$firm_id&mode=show&save_ok=1&retpath=$retpath");
52 exit;
53 }else{echo "$sql<br>$LDDbNoSave";}
55 }else{
56 $mode='bad_data';
58 break;
60 } // end of switch($mode)
62 $bgc=$root_path.'gui/img/skin/default/tableHeaderbg3.gif';
63 $bgc2='#eeeeee';
65 # Start Smarty templating here
66 /**
67 * LOAD Smarty
69 # Note: it is advisable to load this after the inc_front_chain_lang.php so
70 # that the smarty script can use the user configured template theme
72 require_once($root_path.'gui/smarty_template/smarty_care.class.php');
73 $smarty = new smarty_care('system_admin');
75 # Title in toolbar
76 $smarty->assign('sToolbarTitle',"$LDInsuranceCo :: $LDNewData");
78 # href for help button
79 $smarty->assign('pbHelp',"javascript:gethelp('insurance_new.php','new')");
81 # href for close button
82 $smarty->assign('breakfile',$breakfile);
84 # Window bar title
85 $smarty->assign('sWindowTitle',"$LDInsuranceCo :: $LDNewData");
87 # Colllect javascript code
89 ob_start();
93 <script language="javascript">
94 <!--
95 function check(d)
97 if((d.firm_id.value=="")){
98 alert("<?php echo "$LDAlertFirmID \\n $LDPlsEnterInfo"; ?>");
99 d.firm_id.select();
100 return false;
101 }else if((d.name.value=="")){
102 alert("<?php echo "$LDAlertFirmName \\n $LDPlsEnterInfo"; ?>");
103 d.name.select();
104 return false;
105 }else if((d.addr_mail.value=="")){
106 alert("<?php echo "$LDAlertMailingAddress \\n $LDPlsEnterInfo"; ?>");
107 d.addr_mail.select();
108 return false;
109 }else if((d.addr_billing.value=="")){
110 alert("<?php echo "$LDAlertBillingAddress \\n $LDPlsEnterInfo"; ?>");
111 d.addr_billing.select();
112 return false;
113 }else{
114 return true;
117 // -->
118 </script>
120 <?php
122 $sTemp = ob_get_contents();
123 ob_end_clean();
125 $smarty->append('JavaScript',$sTemp);
127 # Buffer page output
129 ob_start();
133 <ul>
134 <?php
135 if(!empty($mode)){
137 <table border=0>
138 <tr>
139 <td><img <?php echo createMascot($root_path,'mascot1_r.gif','0','bottom') ?>></td>
140 <td valign="bottom"><br><font face="Verdana, Arial" size=3 color="#880000"><b>
141 <?php
142 switch($mode)
144 case 'bad_data':
146 echo $LDMissingFirmInfo;
147 break;
149 case 'firm_exists':
151 echo "$LDFirmExists<br>$LDDataNoSave<br>$LDPlsChangeFirmID";
155 </b></font><p>
156 </td>
157 </tr>
158 </table>
159 <?php
162 <form action="<?php echo $thisfile; ?>" method="post" name="insurance_co" onSubmit="return check(this)">
163 <font face="Verdana, Arial" size=-1><?php echo $LDEnterAllFields ?>
164 <table border=0>
165 <tr>
166 <td align=right class="adm_item"><font color=#ff0000><b>*</b></font><?php echo $LDInsuranceCoID ?>: </td>
167 <td class="adm_input"><input type="text" name="firm_id" size=50 maxlength=60 value="<?php echo $firm_id ?>"><br>
168 </td>
169 </tr>
170 <tr>
171 <td align=right class="adm_item"><font color=#ff0000><b>*</b></font><?php echo $LDInsuranceCoName ?>: </td>
172 <td class="adm_input"><input type="text" name="name" size=50 maxlength=60 value="<?php echo $name ?>"><br></td>
173 </tr>
174 <tr>
175 <td align=right class="adm_item"><font color=#ff0000></font><?php echo $LDAddress ?>: </td>
176 <td class="adm_input"><textarea name="addr" cols=40 rows=4 wrap="physical"><?php echo $addr ?></textarea></td>
177 </tr>
178 <tr>
179 <td align=right class="adm_item"><font color=#ff0000><b>*</b></font><?php echo $LDMailingAddress ?>: </td>
180 <td class="adm_input"><textarea name="addr_mail" cols=40 rows=4 wrap="physical"><?php echo $addr_mail ?></textarea></td>
181 </tr>
182 <tr>
183 <td align=right class="adm_item"><font color=#ff0000><b>*</b></font><?php echo $LDBillingAddress ?>: </td>
184 <td class="adm_input"><textarea name="addr_billing" cols=40 rows=4 wrap="physical"><?php echo $addr_billing ?></textarea></td>
185 </tr>
186 <tr>
187 <td align=right class="adm_item"><?php echo $LDEmailAddress ?>: </td>
188 <td class="adm_input"><input type="text" name="addr_email" size=50 maxlength=60 value="<?php echo $addr_email ?>"><br></td>
189 </tr>
190 <tr>
191 <td align=right class="adm_item"><?php echo $LDMainPhoneNr ?>: </td>
192 <td class="adm_input"><input type="text" name="phone_main" size=50 maxlength=60 value="<?php echo $phone_main ?>"><br></td>
193 </tr>
194 <tr>
195 <td align=right class="adm_item"><?php echo $LDAuxPhoneNr ?>: </td>
196 <td class="adm_input"><input type="text" name="phone_aux" size=50 maxlength=60 value="<?php echo $phone_aux ?>"><br></td>
197 </tr>
198 <tr>
199 <td align=right class="adm_item"><?php echo $LDMainFaxNr ?>: </td>
200 <td class="adm_input"><input type="text" name="fax_main" size=50 maxlength=60 value="<?php echo $fax_main ?>"><br></td>
201 </tr>
202 <tr>
203 <td align=right class="adm_item"><?php echo $LDAuxFaxNr ?>: </td>
204 <td class="adm_input"><input type="text" name="fax_aux" size=50 maxlength=60 value="<?php echo $fax_aux ?>"><br></td>
205 </tr>
206 <tr>
207 <td align=right class="adm_item"><?php echo $LDContactPerson ?>: </td>
208 <td class="adm_input"><input type="text" name="contact_person" size=50 maxlength=60 value="<?php echo $contact_person ?>"><br></td>
209 </tr>
210 <tr>
211 <td align=right class="adm_item"><?php echo $LDContactPersonEmailAddr ?>: </td>
212 <td class="adm_input"><input type="text" name="contact_email" size=50 maxlength=60 value="<?php echo $contact_email ?>"><br></td>
213 </tr>
214 <tr>
215 <td align=right class="adm_item"><?php echo $LDContactPersonPhoneNr ?>: </td>
216 <td class="adm_input"><input type="text" name="contact_phone" size=50 maxlength=60 value="<?php echo $contact_phone ?>"><br></td>
217 </tr>
218 <tr>
219 <td align=right class="adm_item"><?php echo $LDContactPersonFaxNr ?>: </td>
220 <td class="adm_input"><input type="text" name="contact_fax" size=50 maxlength=60 value="<?php echo $contact_fax ?>"><br></td>
221 </tr>
222 <tr>
223 <td><input type="image" <?php echo createLDImgSrc($root_path,'savedisc.gif','0'); ?>></td>
224 <td align=right><a href="<?php echo $breakfile ?>"><img <?php echo createLDImgSrc($root_path,'cancel.gif','0') ?> border="0"></a></td>
225 </tr>
226 </table>
227 <input type="hidden" name="sid" value="<?php echo $sid ?>">
228 <input type="hidden" name="mode" value="save">
229 <input type="hidden" name="lang" value="<?php echo $lang ?>">
230 <input type="hidden" name="retpath" value="<?php echo $retpath ?>">
231 </form>
234 </FONT>
235 </ul>
237 <?php
239 $sTemp = ob_get_contents();
240 ob_end_clean();
242 # Assign page output to the mainframe template
244 $smarty->assign('sMainFrameBlockData',$sTemp);
246 * show Template
248 $smarty->display('common/mainframe.tpl');