Пример #1
0
 public static function GetLastKode($cKey, $lUpdate = true, $dTgl = '', $nLen = 18)
 {
     global $scDb;
     if ($dTgl == '') {
         $dTglTransaksi = scDate::GetTglTransaksi();
         $dTgl = $dTglTransaksi;
     }
     $dTgl = date("dmy", strtotime(scDate::Date2String($dTgl)));
     $dTgl = str_replace("-", "", $dTgl);
     $cCabang = scSys::GetCabangUser();
     $cKey .= $cCabang . $dTgl;
     //TBcabang2013100100001
     $nKey = strlen($cKey);
     $nRow = self::GetLastInt($cKey, $lUpdate);
     $cLastKode = $cKey . str_repeat("0", $nLen - $nKey - strlen($nRow)) . $nRow;
     return $cLastKode;
 }