コード例 #1
0
function cashglide($accountid, $allmoney, $chgememo, $chgelisttype, $loginstaname, $listid, $listno, $cogetype, $listdate)
{
    $db = new erp_test();
    $ishaverecord = 0;
    $query = "select * from tb_cashglide where fd_chge_accountid = '{$accountid}' \n\t          and fd_chge_listid = '{$listid}' and fd_chge_listtype = '{$chgelisttype}' ";
    $db->query($query);
    if ($db->nf()) {
        $ishaverecord = 1;
    }
    if ($allmoney != 0 && $ishaverecord == 0) {
        $query = "SELECT MAX(fd_chge_id) as chge_id FROM tb_cashglide where \n              fd_chge_accountid = '{$accountid}' and fd_chge_iskickback <> 1";
        $db->query($query);
        if ($db->nf()) {
            $db->next_record();
            $maxchgeid = $db->f(chge_id);
            $query = "select fd_chge_balance from tb_cashglide \n                where fd_chge_id = '{$maxchgeid}' ";
            $db->query($query);
            if ($db->nf()) {
                $db->next_record();
                $chgebalance = $db->f(fd_chge_balance);
            } else {
                $chgebalance = 0;
            }
        } else {
            $chgebalance = 0;
        }
        if ($allmoney != 0) {
            //金额不等于0 的才插入数据
            if ($cogetype == 0) {
                $endchgebalance = $chgebalance + $allmoney;
                $query = "insert into tb_cashglide(\n                   fd_chge_date     ,  fd_chge_accountid , fd_chge_listid   , \n                   fd_chge_listno   ,  fd_chge_listtype  , fd_chge_addmoney ,\n                   fd_chge_lessen   ,  fd_chge_balance   , fd_chge_memo     ,\n                   fd_chge_makename ,  fd_chge_datetime  , fd_chge_listdate\n                   )values(\n                   now()          ,  '{$accountid}'      , '{$listid}'        ,\n                   '{$listno}'      ,  '{$chgelisttype}'   , '{$allmoney}'      ,\n                   '0'            ,  '{$endchgebalance}' , '{$chgememo}'      ,\n                   '{$loginstaname}',  now()             , '{$listdate}'\n                   )";
                $db->query($query);
            } else {
                $endchgebalance = $chgebalance - $allmoney;
                $query = "insert into tb_cashglide(\n                   fd_chge_date     ,  fd_chge_accountid , fd_chge_listid   , \n                   fd_chge_listno   ,  fd_chge_listtype  , fd_chge_addmoney ,\n                   fd_chge_lessen   ,  fd_chge_balance   , fd_chge_memo     ,\n                   fd_chge_makename ,  fd_chge_datetime  , fd_chge_listdate\n                   )values(\n                   now()          ,  '{$accountid}'      , '{$listid}'        ,\n                   '{$listno}'      ,  '{$chgelisttype}'   , '0'              ,\n                   '{$allmoney}'    ,  '{$endchgebalance}' , '{$chgememo}'      ,\n                   '{$loginstaname}',  now()             , '{$listdate}'\n                   )";
                $db->query($query);
            }
        }
    }
    //------------------------------------
}
コード例 #2
0
function makeqx($loginuser)
{
    global $loginuserqx;
    $db = new erp_test();
    $menufile = "http://www.papersystem.cn/ms2011/include/menuarryfile.php";
    $menuarry = file($menufile);
    //1001±1±地区设置±ico_main_hr.gif±../basic/tb_area_b.php±0±
    //1001代号、1为上级代号、地区设置为名称、ico_main_hr.gif为图片
    //../basic/tb_area_b.php连接地址、0为是否为最底
    $query = "select * from tb_teller \n\t         left join tb_usegroup on fd_usegroup_id = fd_tel_usegroupid\n\t         where fd_tel_id = '{$loginuser}'";
    $db->query($query);
    if ($db->nf()) {
        $db->next_record();
        $str_quanxian = $db->f(fd_tel_doprg);
        //该用户所拥有的权限
        $str_groupqx = $db->f(fd_usegroup_qx);
        //所属于组权限
        if (!empty($str_groupqx)) {
            //组权限
            $tmp_gorupqx = explode("±", $str_groupqx);
            for ($i = 0; $i < count($tmp_gorupqx); $i++) {
                $tmp_zqxfp = explode("@", $tmp_gorupqx[$i]);
                $zqxfp = $tmp_zqxfp[0];
                $arr_qxfp[$zqxfp] = 1;
                //可执行程序
                if (!empty($tmp_zqxfp[1])) {
                    //可执行权限
                    $str_optqx = explode("^", $tmp_zqxfp[1]);
                    //进一步拆分新增等功能
                    for ($k = 0; $k < count($str_optqx); $k++) {
                        $tmpoptqx = $str_optqx[$k];
                        //新增等权限代号
                        $loginuserqx[$zqxfp][$tmpoptqx] = 1;
                        //可执行权限
                    }
                }
            }
        }
        if (!empty($str_quanxian)) {
            //组权限
            $tmp_gorupqx = explode("±", $str_quanxian);
            for ($i = 0; $i < count($tmp_gorupqx); $i++) {
                $tmp_zqxfp = explode("@", $tmp_gorupqx[$i]);
                $zqxfp = $tmp_zqxfp[0];
                $arr_qxfp[$zqxfp] = 1;
                //可执行程序
                if (!empty($tmp_zqxfp[1])) {
                    //可执行权限
                    $str_optqx = explode("^", $tmp_zqxfp[1]);
                    //进一步拆分新增等功能
                    for ($k = 0; $k < count($str_optqx); $k++) {
                        $tmpoptqx = $str_optqx[$k];
                        //新增等权限代号
                        $loginuserqx[$zqxfp][$tmpoptqx] = 1;
                        //可执行权限
                    }
                }
            }
        }
        $temp_arrqx = explode("±", $str_quanxian);
    }
    for ($i = 0; $i < count($temp_arrqx); $i++) {
        $tmp_qxfp = explode("@", $temp_arrqx[$i]);
        $qxfp = $tmp_qxfp[0];
        $arr_qxfp[$qxfp] = 1;
    }
    //---------------------------------------
    for ($i = 0; $i < count($menuarry); $i++) {
        $temp_arr1 = $menuarry[$i];
        $temp_arr2 = explode("±", $temp_arr1);
        $tmpcode = $temp_arr2[0];
        if (empty($temp_arr2[1])) {
            $arr_prgfcode[$tmpcode][fcode] = 0;
        } else {
            $arr_prgfcode[$tmpcode][fcode] = $temp_arr2[1];
        }
        $arr_prgfcode[$tmpcode][isunder] = $temp_arr2[5];
        $arr_prgfcode[$tmpcode][level] = $temp_arr2[6];
    }
    //-------------------------------------
    //找出该有的程序
    $arr_tmpqx = muqx($arr_qxfp, $arr_prgfcode);
    return $arr_tmpqx;
}