-=[ Mr. Bumblebee ]=-
_Indonesia_

Path : /var/www/html/z_admin.bk.230509/php/order/
File Upload :
Current File : /var/www/html/z_admin.bk.230509/php/order/--act.update.php

<?

	if ( empty($total['numid'])) script_re ( $total['cmnall'] , ' À߸øµÈ Á¢±ÙÀÔ´Ï´Ù. ') ;
	$info = $exe->qry_fetch(" from tbl_{$total[table]} where numid = '{$total[numid]}' " , " * " ) ; 
	if ( empty($info['numid'])) script_re ( $total['cmnall'] , ' ÁÖ¹®Á¤º¸¸¦ ãÀ» ¼ö ¾ø½À´Ï´Ù. ') ;
	
	if ( empty($_POST['gs_no'])) script_re ( $total['cmnnb'] . '&mode=view' , ' À߸øµÈ Á¢±ÙÀÔ´Ï´Ù. ') ;
	$gsinfo = $exe->qry_fetch(" from tbl_{$total[table]}_gs where numid = '{$_POST[gs_no]}' " , " * ") ; 
	if ( empty($gsinfo['numid'])) script_re ( $total['cmnnb'] . '&mode=view' , ' ÁÖ¹® »ó¼¼ Á¤º¸¸¦ ãÀ» ¼ö ¾ø½À´Ï´Ù. ') ;
	if ( $gsinfo['orderScode'] != $info['orderScode'] ) script_re ( $total['cmnnb'] . '&mode=view' , ' À¯È¿ÇÏÁö ¾ÊÀº Á¢±ÙÀÔ´Ï´Ù. ') ;
	//str_print($_POST);
	switch ( $gsinfo['formtype']) {
		case 'M' : 
			// Æ÷½º
			for ( $i = 1 ; $i <= 14 ; $i++ ) {
				$pos = str_pad( $i , 2 , '0' , STR_PAD_LEFT) ;
				$posn = $_POST['pos_' . $pos] ;
				if ( empty($posn)) continue ;
				$cd = substr($posn,0,1) ;  // code
				$nfont_change = false ; 
				$nfont_p1 = 0 ; 
				$nfont_p2 = 0 ; 
				$nfont_p3 = 0 ; 
				$nfont_gubun = '' ; 
				if ( $cd == 'e' || $cd == 'p' || $cd == 's' ) {
					$idx = substr($posn , strpos( $posn , ',' )+1) ;
					$nrs = $exe->qry_fetch(" from tbl_{$config[OT1][1]} where numid = '{$idx}' " , " * " ) ; 
					$exe->qry_update( array(
						'o_code'			=> 'f' ,		// °­Á¦º¯È¯
						'p_code'			=> $cd , 
						'p_idx'				=> $idx , 
						'p_arch'				=> 'D' , 
						'p_tn'				=> '' , 
						'p_price1'			=> $nrs['price1'] , 
						'p_price2'			=> $nrs['price2'] , 
						'p_price3'			=> $nrs['price3'] , 
						'p_gubun'			=> $nrs['gubun'] , 
						'p_title'				=> $nrs['title']
					) , "tbl_{$total[table]}_pos" , " gs_no = '{$gsinfo[numid]}' and pos = '{$pos}' ") ;
				} elseif ( $cd == 'n' ) {
					$idx = substr($posn , strpos( $posn , ',' )+1) ;
					$nrs = $exe->qry_fetch(" from tbl_{$config[OT1][1]} where numid = '{$idx}' " , " * " ) ; 
					$exe->qry_update( array(
						'o_code'			=> 'f' ,		// °­Á¦º¯È¯
						'p_code'			=> $cd , 
						'p_idx'				=> $idx ,
						'p_arch'				=> 'D' , 
						'p_tn'				=> '' ,  
						'p_price1'			=> $nrs['price1'] , 
						'p_price2'			=> $nrs['price2'] , 
						'p_price3'			=> $nrs['price3'] , 
						'p_gubun'			=> $nrs['gubun'] , 
						'p_title'				=> $nrs['title']
					) , "tbl_{$total[table]}_pos" , " gs_no = '{$gsinfo[numid]}' and pos in ( '04' , '10' , '13' ) ") ;
					$nfont_change = true ; 
					$nfont_p1 = $nrs['price1'] ; 
					$nfont_p2 = $nrs['price2'] ; 
					$nfont_p3 = $nrs['price3'] ; 
					$nfont_gubun = $nrs['gubun'] ; 
				} elseif ( $cd == 't' ) {
					$posn = substr($posn, strpos( $posn , ',' )+1 ) ;
					$arch = substr($posn, 0 , strpos( $posn , ',' )) ; 
					$posn = substr($posn, strpos( $posn , ',' )+1 ) ;
					$exe->qry_update( array(
						'o_code'			=> 'f' ,		// °­Á¦º¯È¯
						'p_code'			=> $cd , 
						'p_idx'				=> 0 , 
						'p_arch'				=> $arch , 
						'p_tn'				=> $posn ,  
						'p_price1'			=> 0 , 
						'p_price2'			=> 0 , 
						'p_price3'			=> 0 , 
						'p_gubun'			=> '' , 
						'p_title'				=> ''
					) , "tbl_{$total[table]}_pos" , " gs_no = '{$gsinfo[numid]}' and pos = '{$pos}' ") ;
				} elseif ( $cd == 'i' ) {
					$arch = substr($posn , strpos( $posn , ',' )+1) ;
					$exe->qry_update( array(
						'o_code'			=> 'f' ,		// °­Á¦º¯È¯
						'p_code'			=> $cd , 
						'p_idx'				=> 0 , 
						'p_arch'				=> $arch , 
						'p_tn'				=> '' ,  
						'p_price1'			=> 0 , 
						'p_price2'			=> 0 , 
						'p_price3'			=> 0 , 
						'p_gubun'			=> '' , 
						'p_title'				=> ''
					) , "tbl_{$total[table]}_pos" , " gs_no = '{$gsinfo[numid]}' and pos = '{$pos}' ") ;
				}
			}
			// »çÀÌÁî
			$seq = 0 ; 
			$i = 0 ; 
			$topqry = 0 ; 
			$botqry = 0 ; 
			$totalqry = 0 ; 
			$armS = 0 ; 
			$armL = 0 ; 
			//str_print($_POST);
			$exe->qry_delete( "tbl_{$total[table]}_size " , " gs_no = '{$gsinfo[numid]}' ") ;
			while ( true ) {
				$i++ ; 
				if ( !isset($_POST['sizet_' . $i])) break ; 
				if ( empty($_POST['sizet_' . $i]) && empty($_POST['sizeb_' . $i])) continue ;
				$totalqry++ ;
				$seq++ ;  
				if ( !empty($_POST['sizet_' . $i])) $topqry++ ;
				if ( !empty($_POST['sizeb_' . $i])) $botqry++ ;   
				
				if ( $_POST['arm_' . $i] == 'S' ) $armS++ ; 
				if ( $_POST['arm_' . $i] == 'L' ) $armL++ ; 
				
				$exe->qry_insert( array(
					'gs_no'			=> $gsinfo['numid'] , 
					'seq'				=> $seq ,
					'tsize'			=> $_POST['sizet_' . $i] , 
					'bsize'			=> $_POST['sizeb_' . $i] , 
					'armtype'		=> $_POST['arm_' . $i] , 
					'initialnm'		=> $_POST['initial_' . $i] , 
					'numb'			=> $_POST['numb_' . $i] , 
					'npos1'			=> ( $_POST['num1_' . $i] == '1' ? 'Y' : 'N' ) ,
					'npos2'			=> ( $_POST['num2_' . $i] == '2' ? 'Y' : 'N' ) ,
					'npos3'			=> ( $_POST['num3_' . $i] == '3' ? 'Y' : 'N' )  
				) , "tbl_{$total[table]}_size") ;
			}
			// ½ºÅ¸Å· 
			$exe->qry_delete( "tbl_{$total[table]}_stk " , " gs_no = '{$gsinfo[numid]}' ") ;
			foreach( $_POST['s_tit'] as $k=>$v) {
				if ( empty($v) && empty($_POST['s_qry'][$k])) continue ; 
				$exe->qry_insert( array(
					'gs_no'			=> $gsinfo['numid'] , 
					'nm'				=> $v , 
					'qry'				=> intval($_POST['s_qry'][$k])
				) , "tbl_{$total[table]}_stk") ;
			}
			$action = array(
				'totalqry'			=> intval($totalqry) ,
				'top_qry'			=> intval($topqry) ,
				'bot_qry'			=> intval($botqry) ,
				'armS'				=> intval($armS) ,
				'armL'				=> intval($armL) 
			) ;
			if ( $nfont_change ) {
				$action['nfont_p1'] = $nfont_p1 ;
				$action['nfont_p2'] = $nfont_p2 ;
				$action['nfont_p3'] = $nfont_p3 ;
				$action['nfont_gubun'] = $nfont_gubun ;
			}
			break ; 
		case 'T' :
			// »çÀÌÁî 
			$inAction = array() ; 
			$n_qry = 0 ; 
			foreach ( $_POST['s_tit'] as $k=>$v) {
				if ( empty($v) && empty($_POST['s_qry'][$k])) continue ; 
				if ( !is_numeric($_POST['s_qry'][$k])) script_bk( ' ¼ö·®Àº ¼ýÀڷθ¸ ÀÔ·ÂÇÒ ¼ö ÀÖ½À´Ï´Ù. ') ;
				$inAction[] = array(
					'gs_no'			=> $gsinfo['numid'] ,
					'nm'				=> $v ,
					'qry'				=> intval($_POST['s_qry'][$k])
				) ; 
				$n_qry += intval($_POST['s_qry'][$k]) ;
			}
			$exe->qry_delete( "tbl_{$total[table]}_stk" , " gs_no = '{$gsinfo[numid]}' ") ;
			foreach ( $inAction as $v ) {
				$exe->qry_insert ( $v , "tbl_{$total[table]}_stk" ) ;
			}
			$action = array(
				'cr_opt'				=> $_POST['cr_opt'] ,
				'totalqry'			=> intval($n_qry) ,
				'top_qry'			=> intval($n_qry) ,
				'tn_use'			=> ( !empty($_POST['tn_text']) ? 'Y' : 'N' ) ,
				'tn_text'			=> $_POST['tn_text'] , 
				'tn_arch'			=> ( $_POST['tn_arch'] == 'Y' ? 'Y' : 'N' ) , 
				'tn_pos'			=> $_POST['tn_pos'] 
			) ;
			break ; 
		case 'S' :
			$inAction = array() ; 
			$n_qry = 0 ; 
			foreach ( $_POST['s_tit'] as $k=>$v) {
				if ( empty($v) && empty($_POST['s_qry'][$k])) continue ; 
				if ( !is_numeric($_POST['s_qry'][$k])) script_bk( ' ¼ö·®Àº ¼ýÀڷθ¸ ÀÔ·ÂÇÒ ¼ö ÀÖ½À´Ï´Ù. ') ;
				$inAction[] = array(
					'gs_no'			=> $gsinfo['numid'] ,
					'nm'				=> $v ,
					'qry'				=> intval($_POST['s_qry'][$k])
				) ; 
				$n_qry += intval($_POST['s_qry'][$k]) ;
			}
			$exe->qry_delete( "tbl_{$total[table]}_stk" , " gs_no = '{$gsinfo[numid]}' ") ;
			foreach ( $inAction as $v ) {
				$exe->qry_insert ( $v , "tbl_{$total[table]}_stk" ) ;
			}
			$action = array(
				'cr_opt'				=> $_POST['cr_opt'] ,
				'totalqry'			=> intval($n_qry) ,
				'top_qry'			=> intval($n_qry) ,
			) ;
			break ; 
		case 'Q' :
			if ( !is_numeric($_POST['totalqry']))
				script_bk ( '¼ö·®À» È®ÀÎÇØÁÖ¼¼¿ä. ') ;
			
			$action = array(
				'cr_opt'				=> $_POST['cr_opt'] ,
				'totalqry'			=> intval($_POST['totalqry']) ,
				'top_qry'			=> intval($_POST['totalqry']) ,
			) ;
			break ; 
		case 'A' : 
			// ¼ö·® üũ
			$seq = 0 ; 
			$i = 0 ; 
			$topqry = 0 ; 
			$totalqry = 0 ; 
			$armS = 0 ; 
			$armL = 0 ; 
			//str_print($_POST);
			$exe->qry_delete( "tbl_{$total[table]}_size " , " gs_no = '{$gsinfo[numid]}' ") ;
			while ( true ) {
				$i++ ; 
				if ( !isset($_POST['sizet_' . $i])) break ; 
				$totalqry++ ;
				$seq++ ;  
				if ( !empty($_POST['sizet_' . $i])) $topqry++ ;
				if ( $_POST['arm_' . $i] == 'S' ) $armS++ ; 
				if ( $_POST['arm_' . $i] == 'L' ) $armL++ ; 
				$exe->qry_insert( array(
					'gs_no'			=> $gsinfo['numid'] , 
					'seq'				=> $seq ,
					'tsize'			=> $_POST['sizet_' . $i] , 
					'armtype'		=> $_POST['arm_' . $i] , 
					'initialnm'		=> $_POST['initial_' . $i] , 
					'numb'			=> $_POST['numb_' . $i] 
				) , "tbl_{$total[table]}_size") ;
			}
			// ½ºÅ¸Å· 
			if ( isset($_POST['stk_none']) || isset($_POST['stk_name'])) {
				if ( $_POST['stk_none'] == 'Y' ) { // ±¸ÀÔ¾ÈÇÔ 
					$exe->qry_delete( "tbl_{$total[table]}_stk " , " gs_no = '{$gsinfo[numid]}' ") ;
				} else {
					$exe->qry_update( array(
						'nm'			=> $_POST['stk_name'] , 
						'qry'			=> $totalqry
					) , "tbl_{$total[table]}_stk " , " gs_no = '{$gsinfo[numid]}' ") ;
				}
			}
			// ±× ¿Ü  
			$action = array(
				'totalqry'			=> intval($totalqry) ,
				'top_qry'			=> intval($topqry) ,
				'armS'				=> intval($armS) ,
				'armL'				=> intval($armL) ,
				'Atype_np'		=> ( $_POST['pos1'] == 'Y' ? 'Y' : 'N' ) . ( $_POST['pos2'] == 'Y' ? 'Y' : 'N' ) . ( $_POST['pos3'] == 'Y' ? 'Y' : 'N' ) ,
				'Atype_tnm'		=> $_POST['tn_text'] ,
				'Atype_tpos'	=> ( $_POST['t_pos1'] == 'Y' ? 'Y' : 'N' ) . ( $_POST['t_pos2'] == 'Y' ? 'Y' : 'N' ) . ( $_POST['t_pos3'] == 'Y' ? 'Y' : 'N' ) . ( $_POST['t_pos4'] == 'Y' ? 'Y' : 'N' ) . ( $_POST['t_pos5'] == 'Y' ? 'Y' : 'N' ) ,
				'Atype_memo'=> str_convert($_POST['memo']) ,
				'Atype_nfonttype'=> ($_POST['nft'] == 'C' || $_POST['nft'] == 'S'  ? $_POST['nft'] : '' ) ,
				'Atype_archtype'	=> $_POST['archt_' . strtolower($_POST['nft'])] ,
				'Atype_nfont1_c'	=> $_POST['nf1_c'] ,
				'Atype_nfont2_c' => $_POST['nf2_c'] ,
				'Atype_nfont3_c' => $_POST['nf3_c'] ,
				'Atype_initial_c' => $_POST['int_c'] ,
				'Atype_arch_c' => $_POST['arch_c'] ,
				'Atype_nfont1_s'	=> $_POST['nf1_s'] ,
				'Atype_nfont2_s' => $_POST['nf2_s'] ,
				'Atype_nfont3_s' => $_POST['nf3_s'] ,
				'Atype_initial_s' => $_POST['int_s'] ,
				'Atype_arch_s' => $_POST['arch_s']
			) ; 
			break ;
	}
	
	$exe->qry_update( array_merge( $action , array(
		'last_mDate'					=> $total['now'] , 
		'admin_mState_memo'	=> str_convert($_POST['admin_mState_memo']) 
	)) , "tbl_{$total[table]}_gs" , " numid={$gsinfo[numid]}") ;
	
	
	script_re ( $total['cmnnb'] . '&mode=view' , ' ¼öÁ¤µÇ¾ú½À´Ï´Ù. ') ;
	
?>

Copyright © 2017 || Recoded By Mr.Bumblebee