Пример #1
0
session_start();
require "accrp.php";
require "security/secure.php";
beginDocument("Enter personal", $sess_user);
if ($desig_id) {
    $db = getDBConnection();
    # convert dates
    if ($conf_dt == "") {
        $conf_dt = "0000-00-00";
    } else {
        $conf_dt = conv_to_srd($conf_dt);
    }
    if (!isset($join_dt) || $join_dt == "") {
        $join_dt = "0000-00-00";
    } else {
        $join_dt = conv_to_srd($join_dt);
    }
    if ($emp_id3) {
        $query = "UPDATE PERSONAL SET EMP_NAME='{$emp_name}', DESIG_ID={$desig_id}, STATUS='{$status}', AC_NO='{$ac_no}', CONF_DT='{$conf_dt}', JOIN_DT='{$join_dt}' WHERE EMP_ID3={$emp_id3}";
        echo $query;
        $result = mysql_query($query, $db);
        checkMySQLError();
        mysqlReport($result, "Employer sucessfully updated", "main.php", "Home");
        mysql_close($db);
    } else {
        $query = "INSERT INTO PERSONAL (EMP_NAME, DESIG_ID, STATUS, AC_NO, CONF_DT,JOIN_DT) VALUES ('{$emp_name}','{$desig_id}','{$status}', '{$ac_no}', '{$conf_dt}','{$join_dt}')";
        echo $query;
        $result = mysql_query($query, $db);
        checkMySQLError();
        mysqlReport($result, "Employer sucessfully added", "main.php", "Home");
        mysql_close($db);
Пример #2
0
$errorNo1 .= $back_button;
$errorNo2 .= $back_button;
$errorNo3 .= $back_button;
$errorNo4 .= $back_button;
$errorNo5 .= $back_button;
beginDocument("Enter Transaction", $sess_user, $javascript);
if ($submitnow == "1") {
    $db = getDBConnection();
    $ac5_array = get_ac5_array();
    # Get easily the different AC_Codes with AC_ID5
    # For this, AC_ID5 must be a primary key (no doubles)
    $ac_id1 = $ac5_array[$ac_name][1];
    $ac_id2 = $ac5_array[$ac_name][2];
    $ac_id3 = $ac5_array[$ac_name][3];
    $ac_id4 = $ac5_array[$ac_name][4];
    $vr_dt = conv_to_srd($vr_dt);
    $t_dt = get_today_srd_string();
    # First, we have to check, if everything is fine (see above errormessages)
    # This is already done with javascript but we need a fallback-solution
    # 1. An Account must be chosen
    if ($ac_name == -1) {
        die($errorNo1);
    }
    $sum = 0;
    for ($i = 0, $varname2 = "ac_name_" . $i; isset($_POST[$varname2]); $i++, $varname2 = "ac_name_" . $i) {
        $varname = "ac_name_" . $i;
        $ac_name_temp = $_POST[$varname];
        # 2. We need at least one "counter-booking"
        if ($ac_name_temp != -1) {
            $proceed_flag = 1;
        }
Пример #3
0
 function Transactions($where_clause, $startdate, $enddate)
 {
     $this->whereClause = $where_clause . " AND AC_ID2=3";
     $this->startdate = conv_to_srd($startdate);
     $this->enddate = conv_to_srd($enddate);
     $this->balance = 0;
     $this->db = getDBConnection();
     #TODO: AC_ID3!=30 --> this means "no Advances" and should be number independent
     $query = "SELECT AC_ID1, AC_ID2, AC_ID3, AC_ID4 ,AC_ID5, REMARKS, AMOUNT, DR_CR, VR_TP FROM `TRANS` WHERE {$where_clause} AND (AC_ID2=3 AND AC_ID3!=30) AND VR_DT <= '{$this->enddate}' AND VR_DT >= '{$this->startdate}' ";
     #echo "$query<br>";
     $this->result = mysql_query($query, $this->db);
     $this->finishFlag = "";
     checkMySQLError("Transactions");
     $this->totalPayments = get_credit_sum($this->whereClause, $this->enddate, $this->startdate);
     $this->totalReceipts = get_debit_sum($this->whereClause, $this->enddate, $this->startdate);
 }
Пример #4
0
EOD;
beginDocument("Enter PF-Loan entry", $sess_user, $javascript);
if ($emp_id3) {
    $db = getDBConnection();
    if ($type == "PF") {
        $loan_table = "PF_LOAN";
    } else {
        if ($type == "CUF") {
            $loan_table = "CUF_LOAN";
        } else {
            die("Loantype unspecified !");
        }
    }
    $loan_dt = conv_to_srd($loan_dt);
    $loan_start = conv_to_srd($loan_start);
    $loan_end = conv_to_srd($loan_end);
    $query = "INSERT INTO {$loan_table} (EMP_ID3,LOAN_DT,LOAN_START,LOAN_END,LOAN_AMT,INT_AMT,TOT_AMT,INST_NO,INT_RATE) VALUES ('{$emp_name}','{$loan_dt}','{$loan_start}','{$loan_end}','{$loan_amt}','{$int_amt}','{$tot_amt}', '{$inst_no}', '{$int_rate}' )";
    $result = mysql_query($query, $db);
    checkMySQLError();
    mysqlReport($result, "Loan sucessfully added", "main.php", "Home");
    mysql_close($db);
} else {
    if ($type == "PF") {
        $loan_type = "PF-Loan";
        $interest_rate = 10;
    } else {
        if ($type = "CUF") {
            $loan_type = "CUF-Loan";
            $interest_rate = 12;
            # is that true ????
        } else {
Пример #5
0
<?php

# lists all transactions on a specific Account
require "accrp.php";
session_start();
require "security/secure.php";
pt_register('POST', 'ac_name', 'startdate', 'enddate');
beginDocument("list Ledger Sheet", $sess_user);
if ($ac_name) {
    print_ledger_sheet_head($startdate, $enddate, $ac_name);
    $startdate_srd = conv_to_srd($startdate);
    $enddate_srd = conv_to_srd($enddate);
    $db = getDBConnection();
    $result = mysql_query("SELECT VR_NO, VR_DT, VR_TP, REMARKS, AMOUNT, DR_CR FROM TRANS WHERE AC_ID5='{$ac_name}' AND VR_DT >= '{$startdate_srd}' AND VR_DT <= '{$enddate_srd}'", $db);
    checkMySQLError();
    beginPrettyTable("4", "From {$startdate} to {$enddate}<nbs>       Code{$ac_name}");
    printRow(array("opening Balance: " . get_opening_balance("AC_ID5={$ac_name}", $startdate_srd)), "", "1,3");
    printRow(array("<hr>"), "", "1,6");
    printRow(array("VR No", "VR Date", "Vr Type", "Particulars", "Debit", "Credit"));
    while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
        $row["VR_DT"] = conv_to_hrd($row["VR_DT"]);
        if ($row["DR_CR"] == "D") {
            $row["DR_CR"] = $row["AMOUNT"];
            $row["AMOUNT"] = "&nbsp;";
        } else {
            $row["DR_CR"] = "&nbsp;";
        }
        printRow($row, "fluct");
    }
    printRow(array("", "", "DebitSum:", get_debit_sum("AC_ID5={$ac_name}", $enddate_srd, $startdate_srd)), "", "1,2");
    printRow(array("", "", "CreditSum:", get_credit_sum("AC_ID5={$ac_name}", $enddate_srd, $startdate_srd)), "", "1,3");