Показать сообщение отдельно
Старый 26.11.2013, 15:33   #1  
DmitryK is offline
DmitryK
Участник
 
179 / 76 (3) ++++
Регистрация: 22.12.2011
Классные программисты MS Бразилии создали сей шедевр
Разбираясь с чудесной работой элемента бразильского слоя был обнаружен сей код, который не нуждается, по моему, в комментариях. Код достаточно свеженький.
X++:
//<MSBS user="jjuni" woritem="Layout Danf" date="05/10/2012">
    maskPhone = strreplace(eFiscalDocument.recipientPhone(), "-", "");
    maskPhone = strreplace(eFiscalDocument.recipientPhone(), "(", "");
    maskPhone = strreplace(eFiscalDocument.recipientPhone(), ")", "");
    maskPhone = strreplace(eFiscalDocument.recipientPhone(), " ", "");

    qtdChar = strlen(maskPhone);

    switch(qtdChar)
    {
        case 10:
        case 11:
            maskPhone = "(" + substr(maskPhone, 1, 2) + ") " + substr(maskPhone, 3, 4) + "-" + substr(maskPhone, 7, 4);
        break;
        case 8:
            maskPhone = substr(maskPhone, 1, 4) + "-" + substr(maskPhone, 5, 4);
        break;
        default:
            maskPhone = eFiscalDocument.recipientPhone();
        break;
    }

    return maskPhone;
    //</MSBS>


С уважением, Дмитрий.