123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712 |
- var PrnKind =1;
- var PrnMarginLeft =0;
- var PrnMarginTop =0;
- var PageSize = "";
- function astfInsertGridData(src_grid, trgt_grid, row_select_val, chkbox_col_nm, src_grid_col_nm_matrix, dupl_val_matrix)
- {
-
- var grid_matrix_val = astfChkMatrixData(src_grid_col_nm_matrix)
- if(grid_matrix_val == "E"){
- return 0;
- }
- var dupl_matrix_val = astfChkMatrixData(dupl_val_matrix);
- if(dupl_matrix_val == "E"){
- return 1;
- }
- var chk_opener = checkOpener();
- var src_gridCols = src_grid.cols;
- var trgt_gridCols = trgt_grid.cols;
- if(row_select_val == 1){
- var insert_vali = true;
- var src_node_set = src_grid.nodeset + "[" + src_grid.row+ "]/";
- if(dupl_val_matrix != ""){
- var dupl_trgt_nodeset = trgt_grid.nodeset + "[";
- var chk = dupl_matrix_val.length;
- for(var j=0; j < chk; j+=2){
-
- if(j == 0){
- dupl_trgt_nodeset += dupl_matrix_val[j+1] + "='" + model.getValue(src_node_set+dupl_matrix_val[j]) + "'";
- } else {
- dupl_trgt_nodeset += " and " + dupl_matrix_val[j+1] + "='" + model.getValue(src_node_set+dupl_matrix_val[j]) + "'";
- }
- }
- dupl_trgt_nodeset += "]/" + dupl_matrix_val[1];
- if ( chk_opener ) {
- if(opener.model.getValue(dupl_trgt_nodeset) != ""){
- insert_vali = false;
- }
- } else {
- if(model.getValue(dupl_trgt_nodeset) != ""){
- insert_vali = false;
- }
- }
- if(!insert_vali){
- messageBox("데이터가 중복되어 처리 ", "E001");
- return 2;
- }
- }
- if(insert_vali) {
- trgt_grid.addRow();
- var trgt_node_set = trgt_grid.nodeset + "[" + (trgt_grid.rows-1) + "]/";
-
-
- for(var i = src_grid.fixedcols; i < src_gridCols; i++){
- var src_ref_nm = src_grid.colattribute(i,"ref");
- for(var j = trgt_grid.fixedcols; j < trgt_gridCols; j++){
- var trgt_ref_nm = trgt_grid.colattribute(j,"ref");
- if( src_ref_nm == trgt_ref_nm){
- if ( chk_opener ) {
- opener.model.setValue(trgt_node_set+trgt_ref_nm,model.getValue(src_node_set+src_ref_nm));
- } else {
- model.setValue(trgt_node_set+trgt_ref_nm,model.getValue(src_node_set+src_ref_nm));
- }
- }
- }
- }
-
-
- if( src_grid_col_nm_matrix != ""){
- var chk = grid_matrix_val.length;
- for(var i=0; i < chk; i+=2){
- if ( chk_opener ) {
- opener.model.setValue(trgt_node_set+grid_matrix_val[i+1],model.getValue(src_node_set+grid_matrix_val[i]));
- } else {
- model.setValue(trgt_node_set+grid_matrix_val[i+1],model.getValue(src_node_set+grid_matrix_val[i]));
- }
- }
- }
-
- model.refresh();
- }
- } else if(row_select_val == 2){
- if(chkbox_col_nm == ""){
-
- return 3;
- }
- var insert_vali = true;
- var insert_cnt = 0;
-
- for(var t = src_grid.fixedrows; t < src_grid.rows; t++){
- var src_node_set = src_grid.nodeset + "[" + t + "]/";
- insert_vali = true;
- if(model.getValue(src_node_set+chkbox_col_nm) == "true"){
- if(dupl_val_matrix != ""){
- var dupl_trgt_nodeset = trgt_grid.nodeset + "[";
- var chk = dupl_matrix_val.length;
- for(var j=0; j < chk; j+=2){
-
- if(j == 0){
- dupl_trgt_nodeset += dupl_matrix_val[j+1] + "='" + model.getValue(src_node_set+dupl_matrix_val[j]) + "'";
- } else {
- dupl_trgt_nodeset += " and " + dupl_matrix_val[j+1] + "='" + model.getValue(src_node_set+dupl_matrix_val[j]) + "'";
- }
- }
- dupl_trgt_nodeset += "]/" + dupl_matrix_val[1];
- if ( chk_opener ) {
- if(opener.model.getValue(dupl_trgt_nodeset) != ""){
- insert_vali = false;
- }
- } else {
- if(model.getValue(dupl_trgt_nodeset) != ""){
- insert_vali = false;
- }
- }
- }
- if(insert_vali){
- insert_cnt++;
- trgt_grid.addRow();
- var trgt_node_set = trgt_grid.nodeset + "[" + (trgt_grid.rows-1)+ "]/";
-
- for(var i = src_grid.fixedcols; i < src_gridCols; i++){
- var src_ref_nm = src_grid.colattribute(i,"ref");
- for(var j = trgt_grid.fixedcols; j < trgt_gridCols; j++){
- var trgt_ref_nm = trgt_grid.colattribute(j,"ref");
- if( src_ref_nm == trgt_ref_nm){
- if ( chk_opener ) {
- opener.model.setValue(trgt_node_set+trgt_ref_nm,model.getValue(src_node_set+src_ref_nm));
- } else {
- model.setValue(trgt_node_set+trgt_ref_nm,model.getValue(src_node_set+src_ref_nm));
- }
- }
- }
- }
-
-
- if( src_grid_col_nm_matrix != ""){
- var chk = grid_matrix_val.length;
- for(var i=0; i < chk; i+=2){
- if ( chk_opener ) {
- opener.model.setValue(trgt_node_set+grid_matrix_val[i+1],model.getValue(src_node_set+grid_matrix_val[i]));
- } else {
- model.setValue(trgt_node_set+grid_matrix_val[i+1],model.getValue(src_node_set+grid_matrix_val[i]));
- }
- }
- }
-
-
- }
- }
- }
- model.refresh();
- if(insert_cnt == 0){
-
- return 2;
- }
- } else if(row_select_val == 3){
- var insert_vali = true;
- var insert_cnt = 0;
- for(var t = src_grid.fixedrows; t < src_grid.rows; t++){
- var src_node_set = src_grid.nodeset + "[" + t + "]/";
-
- insert_vali = true;
- if(dupl_val_matrix != ""){
- var dupl_trgt_nodeset = trgt_grid.nodeset + "[";
- var chk = dupl_matrix_val.length;
- for(var j=0; j < chk; j+=2){
-
- if(j == 0){
- dupl_trgt_nodeset += dupl_matrix_val[j+1] + "='" + model.getValue(src_node_set+dupl_matrix_val[j]) + "'";
- } else {
- dupl_trgt_nodeset += " and " + dupl_matrix_val[j+1] + "='" + model.getValue(src_node_set+dupl_matrix_val[j]) + "'";
- }
- }
- dupl_trgt_nodeset += "]/" + dupl_matrix_val[1];
-
- if ( chk_opener ) {
- if(opener.model.getValue(dupl_trgt_nodeset) != ""){
- insert_vali = false;
- }
- } else {
- if(model.getValue(dupl_trgt_nodeset) != ""){
- insert_vali = false;
- }
- }
- }
-
- insert_cnt++;
- trgt_grid.addRow();
- var trgt_node_set = trgt_grid.nodeset + "[" + (trgt_grid.rows-1)+ "]/";
- for(var i = src_grid.fixedcols; i < src_gridCols; i++){
- var src_ref_nm = src_grid.colattribute(i,"ref");
- for(var j = trgt_grid.fixedcols; j < trgt_gridCols; j++){
- var trgt_ref_nm = trgt_grid.colattribute(j,"ref");
- if( src_ref_nm == trgt_ref_nm){
- if ( chk_opener ) {
- opener.model.setValue(trgt_node_set+trgt_ref_nm,model.getValue(src_node_set+src_ref_nm));
- } else {
- model.setValue(trgt_node_set+trgt_ref_nm,model.getValue(src_node_set+src_ref_nm));
- }
- }
- }
- }
-
-
- if( src_grid_col_nm_matrix != ""){
- var chk = grid_matrix_val.length;
- for(var i=0; i < chk; i+=2){
- if ( chk_opener ) {
- opener.model.setValue(trgt_node_set+grid_matrix_val[i+1],model.getValue(src_node_set+grid_matrix_val[i]));
- } else {
- model.setValue(trgt_node_set+grid_matrix_val[i+1],model.getValue(src_node_set+grid_matrix_val[i]));
- }
- }
- }
-
- model.refresh();
-
- }
- if(insert_cnt == 0){
-
- return 2;
- }
- }
-
- if ( chk_opener ) {
- opener.model.refresh();
- } else {
- model.refresh();
- }
- return 10;
- }
- function astfChkMatrixData(matrix_val)
- {
- var col_data = "";
- if(matrix_val != ""){
- var col_flag = ",";
- col_data = matrix_val.split(col_flag);
- if(col_data.length <= 1) {
- col_data = "E";
- return col_data;
- }
- var chk = col_data.length % 2;
- if( chk == 1 ) {
- col_data = "E";
- return col_data;
- }
- }
- return col_data;
- }
- function astfMakePopup(ctrID, xPath){
-
- var id = ctrID.elementName;
- if (m_event.button == 3){
- if(id == "xforms:datagrid"){
- if(ctrID.isCell(m_event.target) && ctrID.mouseRow >= ctrID.fixedrows){
- window.setPopupMenu(true, xPath, label, func, false);
- }else{
- window.setPopupMenu(false);
- }
- } else if(id == "xforms:calendar" || id == "xforms:select" || id == "xforms:select1" || id == "xforms:treeview"){
- if(ctrID.isCell(m_event.target)){
- window.setPopupMenu(true, xPath, "label", "func", false);
- }else{
- window.setPopupMenu(false);
- }
- } else if(id == "xforms:multilinegrid"){
- if(ctrID.mouseRow >= ctrID.fixedrows){
- window.setPopupMenu(true, xPath, "label", "func", false);
- }else{
- window.setPopupMenu(false);
- }
- } else if(id == "xforms:img"){
- window.setPopupMenu(true, xPath, "label", "func", false);
- } else {
- window.setPopupMenu(false);
- }
- }
- }
- function astfAddCombo(combopath, parentnode, nodename, nodeval)
- {
- nodename = nodename.split(",");
- nodeval = nodeval.split(",");
- if(nodename.length != nodeval.length){
- return;
- }
-
- var label = model.instances.item(0).createElement(nodename[0]);
- var val = model.instances.item(0).createElement(nodename[1]);
- var combo = model.instances.item(0).createElement(parentnode);
- label.setValue("" + nodeval[0] + "");
- val.setValue("" + nodeval[1] + "");
-
- combo.appendChild(label);
- combo.appendChild(val);
-
- chkNode = model.instances.item(0).selectSingleNode(combopath);
- if(chkNode == null){
- model.makeNode(combopath);
- srcNode = model.instances.item(0).selectSingleNode(combopath);
- }else{
- srcNode = model.instances.item(0).selectSingleNode(combopath);
- }
-
- desNode = model.instances.item(0).selectSingleNode(combopath + "/" + parentnode);
-
-
-
- if(desNode == null){
-
- return 0;
- }else{
- srcNode.insertBefore(combo, desNode);
-
- }
- model.refresh();
- }
- function astfCopyNodeSet(trgtNodeSet, srcNodeSet) {
-
- var nodename_array = trgtNodeSet.split("/");
- var nodename = "";
- for( var i = 1; i< nodename_array.length -1; i++ ) {
- nodename += "/"+nodename_array[i];
- }
-
- var srcNodeList = model.instance1.selectNodes(srcNodeSet);
- if( srcNodeList.length == 0 )
- return;
-
-
- var tmpNodeSet;
- for( var j = srcNodeList.length - 1; j >= 0; j-- ) {
- tmpSrcNode = srcNodeList.item(j).cloneNode(true);
- tmpSrcNode.nodeName = nodename_array[i];
- model.duplicate(nodename, tmpSrcNode);
- }
- }
- function astfTrim(val)
- {
- var result_val = "";
- var i = 0;
- var j = 0;
-
- for(i = 0; i < val.length; i++){
- var temp = val.substr(i,1);
- if(temp == null || temp == "" || temp == " " || temp == " " || temp == "undefined"){
- } else {
- break;
- }
- }
- for(j = val.length; j > 0; j--){
- var temp = val.substr(j,1);
- if(temp == null || temp == "" || temp == " " || temp == " " || temp == "undefined"){
- } else {
- break;
- }
- }
- return ( (i > 0) || (j < val.length) ) ? val.substring(i, j-i+1) : val;
- }
- function astfMatrixData(pData, pRow, pCol)
- {
- var rowSep = "▩";
- var colSep = "▦";
- var arrRow = pData.split(rowSep);
- if(arrRow.length <= pRow) return "";
- var arrCol = arrRow[pRow].split(colSep);
- if(arrCol.length <= pCol) return "";
- return arrCol[pCol];
- }
- function astfStartFormat(pX, pY, pPage) {
- PageSize = pPage;
- if ( PrnKind == 2 || PrnKind == 7 ) {
-
-
-
-
-
-
- if(pPage == "S") {
- return "AA107000500V00H00L0101";
- }else {
- return "AA110300820V00H00L0101";
- }
- } else {
- return "^XA^SEE:UHANGUL.DAT^FS^CWQ,E:AAAAA.FNT^FS^CI26" + "^LH" + pX + "," + pY;
- }
-
- }
- function astfEndFormat(pCnt) {
- var vCnt = 1;
-
- if (isNull(pCnt)) {
- vCnt = 1;
- } else {
- vCnt = pCnt
- }
- if ( PrnKind == 2 || PrnKind == 7 ) {
- return "Q"+ vCnt +"Z";
- } else {
- return "^PQ" + vCnt + "^XZ";
- }
-
- }
- function astfFiendOrigin(pX, pY) {
- if ( PrnKind == 2 || PrnKind == 7 ) {
- return "V"+pY+"H"+pX;
- } else {
- return "^FO" + pX + "," + pY;
- }
-
- }
- function astfChangeFont(pF, pH, pW) {
- var sBuf = "";
-
- sBuf = "^CF" + pF;
- sBuf += "," + pH;
- sBuf += "," + pW;
-
- return sBuf;
- }
- function astfGraphicBox(pX, pY, pW, pH, pBF) {
- var sBuf = "";
- if ( PrnKind == 2 || PrnKind == 7 ) {
- } else {
- sBuf = astfFiendOrigin(pX, pY);
- sBuf += "^GB" + pW + "," + pH + "," + pBF + "^FS";
- }
- return sBuf;
- }
- function astfFieldDataA(pX, pY, pData, pReverse) {
- var sBuf = "";
- sBuf = astfFiendOrigin(pX, pY);
- if (!isNull(pReverse)) {
- if (pReverse.getTrim() == "Y") {
- sBuf += "^FR";
- }
- }
-
- sBuf += "^FD" + pData + "^FS";
-
- return sBuf;
- }
- function astfFieldDataH(pX, pY, pW, pH, pData) {
- var sBuf = "";
-
- sBuf += astfFiendOrigin(pX, pY);
- sBuf += "^CFA" + "," + pW + "," + pH;;
- sBuf += "^FD" + pData + "^FS";
- return sBuf;
- }
- function astfBarCode_Code39(pX, pY, pO, pH, pData, pBigYN) {
- var sBuf = "";
- pX = parseInt(pX) + parseInt(PrnMarginLeft);
- pY = parseInt(pY) + parseInt(PrnMarginTop);
-
- sBuf = astfFiendOrigin(pX, pY);
- if ( PrnKind == 2 || PrnKind == 7 ) {
-
- if ( PageSize == "S" ) {
- sBuf += "V"+pY+"H"+pX+"BG01070" + pData ;
- } else {
- sBuf += "V"+pY+"H"+pX+"BG02070" + pData ;
- }
-
-
-
- } else {
- if(pBigYN == "S"){
- sBuf += "^BY1,2.0";
- } else if(pBigYN == "B"){
- sBuf += "^BY2,2.0";
- } else {
- sBuf += "^BY2,2.0";
- }
- sBuf += "^B3" + pO + ",N," + pH + ",N,N^FD" + pData + "^FS";
- }
- return sBuf;
- }
- function astfPrintOutH(pX, pY, pFont, pImage, pData, pReverse) {
- var sBuf = "";
-
- if ( PrnKind == 2 || PrnKind == 7 ) {
- sBuf= CommAX.PrtImgOut(pX,pY,pData);
- } else {
- sBuf = astfFontSize(pFont);
- sBuf += CommAX.PrtImgOut(pImage, pData);
- sBuf += astfFiendOrigin(pX, pY);
- sBuf += "^XG"+pImage+",2,1^FS";
- }
- return sBuf;
- }
- function astfPrintOutA(pX, pY, pFont, pData, pReverse) {
- var sBuf = "";
- sBuf += astfFontSize(pFont);
- sBuf += astfFieldDataA(pX, pY, pData, pReverse);
-
- return sBuf;
- }
- function astfPrintOut(pX, pY, pFont, pData, pReverse) {
- var sBuf = "";
-
- pX = parseInt(pX) + parseInt(PrnMarginLeft);
- pY = parseInt(pY) + parseInt(PrnMarginTop);
-
-
- if ( PrnKind == 2 ) {
- sBuf = astfFiendOrigin(pX, pY);
- sBuf += astfFontSize(pFont);
-
-
-
-
-
-
-
- sBuf += pData+"";
- } else if (PrnKind == 7){
- if(pFont == 6 || pFont == 7 || pFont == 10){
- sBuf += CommAX.PrtImgOut(parseInt( pY), parseInt(pX), pData,2,2,"0","K2B");
- } else {
- sBuf += CommAX.PrtImgOut(parseInt( pY), parseInt(pX), pData,1,1,"0","K2B");
- }
-
- } else {
- sBuf = astfFiendOrigin(pX, pY);
- sBuf += astfFontSize(pFont);
- if (!isNull(pReverse)) {
- if (pReverse.getTrim() == "Y") {
- sBuf += "^FR";
- }
- }
- sBuf += "^FD"+pData+"^FS";
- }
- return sBuf;
- }
- function astfFontSize(pFont) {
- var sBuf = "";
- var pW = 0;
- var pH = 0;
-
- if ( PrnKind == 2 || PrnKind == 7 ) {
- if(pFont == 6 || pFont == 7 || pFont == 10){
- sBuf ="L0202K8D";
- } else {
- sBuf ="L0101K9D";
- }
- } else {
-
- if(pFont == 1){
- pH = 21;
- pW = 10;
- } else if(pFont == 2){
- pH = 26;
- pW = 19;
- } else if(pFont == 3){
- pH = 31;
- pW = 23;
- } else if(pFont == 4){
- pH = 36;
- pW = 28;
- } else if(pFont == 5){
- pH = 41;
- pW = 33;
- } else if(pFont == 6){
- pH = 46;
- pW = 38;
- } else if(pFont == 7){
- pH = 50;
- pW = 43;
- } else if(pFont == 8){
- pH = 55;
- pW = 48;
- } else if(pFont == 9){
- pH = 60;
- pW = 53;
- } else if(pFont == 10){
- pH = 70;
- pW = 62;
- } else if(pFont == 11){
- pH = 25;
- pW = 13;
- } else if(pFont == 21){
- pH = 25;
- pW = 19;
- } else if(pFont == 24){
- pH = 26;
- pW = 16;
- } else if(pFont == 27){
- pH = 31;
- pW = 26;
- } else if(pFont == 28){
- pH = 30;
- pW = 19;
- }else if(pFont == 29){
- pH = 31;
- pW = 20;
- }else if(pFont == 31){
- pH = 33;
- pW = 23;
- } else if(pFont == 32){
- pH = 35;
- pW = 24;
- } else if(pFont == 33){
- pH = 35;
- pW = 25;
- } else if(pFont == 34){
- pH = 35;
- pW = 26;
- } else if(pFont == 35){
- pH = 35;
- pW = 28;
- }
- sBuf = "^AQN,"+pH+","+pW;
- }
-
- return sBuf;
- }
- function astfNullValidation(pNodeSet, pCol, pMsg)
- {
- var cntnull = model.getXPathValue("count(" + pNodeSet + " [normalize-space(string(" + pCol + ")) = ''])");
-
- if(cntnull > 0)
- {
- messageBox(pMsg , "C001");
- return false;
- }
- return true;
- }
- function astfCopyRenameNodeSet(refNodeSet, srcNodeSet)
- {
- var refNodeCnt = instance1.selectNodes(refNodeSet).length;
-
- for(var i = 1; i <= instance1.selectNodes(srcNodeSet).length; i++)
- {
- var makeNodeCnt = parseInt(refNodeCnt) + parseInt(i);
- model.makeNode(refNodeSet + "[" + makeNodeCnt + "]");
- model.copyNode(refNodeSet + "[" + makeNodeCnt + "]", srcNodeSet + "[" + i + "]");
- }
- }
|