# 4. If a an Amount is given, an Account must be chosen also if ($amount_temp != 0 and $ac_name_temp == -1) { die($errorNo4); } } if ($proceed_flag != 1) { die($errorNo2); } if ($sum != $amount) { die($errorNo3); } # This Locking-stuff is needed, to get a proper ID for vouchers. Because one voucher # consists of at least 2 entries (transactions), we can't use an autoincrement/primary key # To be sure, to get a unique number (and to make this application network-usable) # we have to lock the table $personal_array = get_personal_array(); $result = mysql_query("LOCK TABLES TRANS WRITE", $db); checkMySQLError(); $result = mysql_query("SELECT MAX(VR_NO) FROM TRANS", $db); checkMySQLError(); $row = mysql_fetch_array($result); $max_vr_no = $row["MAX(VR_NO)"]; $max_vr_no++; if ($vr_tp == "AD" || $vr_tp == "AR") { $party = "CRP-Emp ID " . $party . " (" . $personal_array[$party] . ")"; } # insert the fields ... $result = mysql_query("INSERT INTO TRANS (VR_NO, VR_DT, VR_TP, AC_ID1, AC_ID2, AC_ID3, AC_ID4, AC_ID5, DR_CR, CHQ_NO, AMOUNT, PARTY, REMARKS, T_DT, DEPT) VALUES ('{$max_vr_no}','{$vr_dt}','{$vr_tp}','{$ac_id1}','{$ac_id2}','{$ac_id3}','{$ac_id4}','{$ac_name}','{$dr_cr}','{$chq_no}','{$amount}','{$party}','{$remarks}','{$t_dt}','')", $db); checkMySQLError(); # Now, the worst part of the story, inserting these "counter-billings" if ($dr_cr == "C") {
<?php echo "<td><a href='list_loan.php?type={$type}'>show List</a></td>"; ?> </tr> <tr> <td><hr color='black'></td> </tr> <?php endPrettyTable(); # it just print out some HTML ?> </td> <td valign=top align=center width='65%'> <?php $db = getDBConnection(); $employer_array = get_personal_array(); openForm("loan_form", $PHP_SELF, "onSubmit=\"return confirmSubmit()\""); beginPrettyTable("2", "enter {$loan_type} entry"); makeHiddenField("type", $type); makeDropBox("emp_id3", $employer_array, "Employers Name"); startRow(); makePlainTextField("loan_dt", "", "Loan Santion Dt.", 10); makePlainTextField("loan_start", "", "Deduction Start Dt.", 10, "onChange=\"checkdate(this.value) && updateFields()\""); endRow(); startRow(); makePlainTextField("inst_no", "", "Instalment No", 6, "onChange=\"updateFields()\""); makePlainStaticField("loan_end", "", "Loan End Dt.", 10); endRow(); makeStaticField("interest_rate", "{$interest_rate}" . "%", "Interest Rate", 6); startRow(); makePlainTextField("loan_amt", "", "Loan Amount", 10, "onChange=\"updateFields()\"");