หน้าเว็บ

วันเสาร์ที่ 23 กรกฎาคม พ.ศ. 2559

Ubuntu : Install flash on Ubuntu.

Ubuntu : Install flash on Ubuntu.
Ubuntu : Install flash on Ubuntu. Web browser up file on RP Online not work.

use :
sudo apt-get install flashplugin-installer
 
ที่มา : http://askubuntu.com/questions/341428/how-to-install-flash-player-on-ubuntu

Axapta : Send mail to zimbra

Axapta : Send mail to zimbra
Job Test

static void Job6(Args _args)
{
 
    SysMailer   mail;
 
    str         strBody = "Test send mail From Axapta. ·´ÊͺÊè§àÁÅì¨Ò¡ Axapta à»ç¹ÀÒÉÒä·Â";
    str         strSubject = "Mail From Axapta.";
    sysMailerCustomHeaders          headers;
    ;
 
    mail = new SysMailer();
    mail.SMTPRelayServers().add("zimbra.sci.com");
    mail.fromAddress("suwit_j@sci.com");
    mail.tos().add("suwit_j@sci.com"); //Send 1
    //mail.tos().add("suwit_j@sci.com"); //Send 2
    //mail.tos().add("suwit_j@sci.com"); //Send 3
    // Set Font Thai.
    headers = mail.customHeaders();
    headers.add('Content-Type', 'text/plain; charset=windows-874');
 
    // Build the Message
    mail.htmlBody(strBody);
    mail.subject(strSubject);
 
    mail.sendMail();
   
box::info("Send Mail Complete.");
 
}
 
*** เครื่อง ที่จะ Run และส่ง Mail ได้ ต้อง Register DSMailer.dll ที่เครื่องก่อน

ถ้าไม่ได้ Register จะ Error : com object of class 'dundas.mailer'
1. ให้ Register file DSMailer.dll โดย Copy ไฟล์จาก C:\AxaptaSP4\Axapta Client\Bin
2. ไปไว้ที่ windows\system32 ถ้า 64bit เข้าไปที่ c:\windows\sysWOW64\
3. เปิด cmd ด้วยสิทธิ์ Admin
4. CD c:\windows\sysWOW64\ หรือ c:\windows\system32
5. run คำสั่ง regsvr32 DSMailer.dll
ถ้าเป็น Windows XP สามารถ Copy ไฟล์ไป แล้วคลิกขวาเลือก Register ได้เลย ไม่ต้องเข้าผ่าน CMD ก็ได้

เพิ่มเติม
Code แนบๆ ไฟล์
- Code  
mail.attachments().add("C:\\Newfolder\\Drw.pdf");
 
แต่ต้องตัด headers.add('Content-Type', 'text/plain; charset=windows-874'); ออก
- ส่งได้เฉพาะภาษาอังกฤษ ภาษาไทยไม่แสดง
- แต่ถ้าไม่แนบส่งภาษาไทยได้

Axapta : The WINAPI class on Axapta

Axapta : The WINAPI class on Axapta
Like most AX developers I use the WINAPI class quite often. Its a very useful class when handling files that need to be accessed outside of the AX environment

 
  static void FO_WinApi(Args _args)
  {
      str     root        = "C:";
      str     path        = "C:\\dionne";
      str     fileName    = "SalesInvoice.pdf";
      str     fileName2   = "SalesInvoice1.pdf";
      str     file        = path + "\\" + fileName;
      str     file2       = path + "\\" + fileName2;
      int     x, y;
      ;
 
      // Does folder exist?
      print WinAPI::folderExists(path);
 
      // Does file exist?
      print WinAPI::fileExists(file);
 
      // Copy file.
      print WinAPI::copyFile(file,file2);
 
      // New file exists?
      print WinAPI::fileExists(file2);
 
      // Delete new file.
      print WinAPI::deleteFile(file2);
 
      // New file still there?
      print WinAPI::fileExists(file2);
 
      // Get current cursor position.
      [x, y] = WinAPI::getCursorPos();
 
      print x;
      print y;
 
      // Get time and date format.
      print WinAPI::getSystemLocaleDateStr();
      print WinAPI::getSystemLocaleTimeStr();
 
      // Gets current computer name.
      print WinAPI::getComputerName();
 
      // Gets total disk space.
      print int2str(WinAPI::getDiskTotalSpaceInKb(root)
             / 1000) + " MB";
 
      // Gets current free space on disk.
      print int2str(WinAPI::getDiskFreeSpaceInKb(root)
             / 1000) + " MB";
 
      // Date when file was last accessed.
      print WinAPI::getFileAccessedDate(file);
 
      // Time when file was last accessed(In seconds).
      print WinAPI::getFileAccessedTime(file);
 
      // Gets path to temp directory.
      print WinAPI::getTempPath();
 
      // Gets a generated temporary filename, prefix "FO_".
      print WinAPI::getTempFilename(path, "FO_");
 
      pause;
 
  }
 
In addition to file information the WINAPI class can execute different file types from within Dynamics AX by of course using the file name as a parameter.

For example lets say you want to launch a PDF file saved in table within AX. WinAPI::ShellExecute() will do this for you.

Axapta : Step Create And Post Document On Axapta.

Axapta : Step Create And Post Document On Axapta.
DS
1. สร้าง Item Part , Part-s, Valve
- Part , Part-s ชนิดเป็น Item ใส่ Item Group, Model Group และ Dimension Group ให้เรียบร้อย
- Valve เป็น Bom ใส่ Item Group, Model Group และ Dimension
2. สร้าง Bom ให้กับ Valve ใส่ Part และ ค่าจ้างเข้าไป ใส่จำนวน Approve และ Active ให้เรียบร้อย

SS
3. สร้าง SO เปิดขาย Vavle ขายกี่ตัว ราคาเท่าไหร่ Posting Confirmation

WH
4. Shortage ดูรายงานที่ได้ PO PD
5. ทำรับ PO Part ใส่ราคาค่า Part WH, Location, Batch ให้เรียบร้อย Posting ---> Packing list และ Post Invoice (ทำ Post Invoice เลยก็ได้)
6. PO จ้าง -s ใส่ราคาค่าจ้าง WH, Location, Batch Posting ---> Purchase Order
7. ทำเอกสาร Transfer โอนของไปให้ร้าน TIS ใส่ WH Location From , TO จำนวน Batch ให้ครบ แล้วจอง Part ที่จะโอนไปร้าน ในข้อ 5.ที่ทำรับเข้ามา จองของ ใช้ Inventory Reservation หรือ Auto Reserve ก็ได้
8. Post เอกสาร TIS
9. ทำรับ PO -s ใส่ค่าจ้าง แล้ว Post Invoice

PD
PD ประกอบ Part หลายชิ้นมารวมกันถ้ามี (ตัวอย่างที่ทำไม่มี ข้ามไปข้อ 14. ทำ PD ผลิต Valve เลย)
10. PD ต้องไป Update Estimation และ Job Scheduling ก่อน
11. จองของ Part และ -s จากร้านที่ทำรับเข้ามาเพื่อมาทำ Valve จองของที่ Bom ---> Inventory Reservation ทั้งค่าจ้างและ Part
12. Update Start ดูที่ Tab General ต้องติ๊ก 3 ปุ่ม
- Post picking list now คือให้ Post picking list Auto ถ้าไม่ติ๊กต้องไป Post picking list เอง
หรือ ทำ Packing list เองโดยสร้าง Packing list เข้าไปที่ Journals ---> Packing list สร้าง Create new line ขึ้นมา จองของ Reservation แล้ว Post
- Start Production
- Complete picking list journal
13. คีย์ Job Card เพิ่มเติม ค่าแรง Loss คีย์ไม่ได้ไม่เป็นไร ต้องมี Route เอาเฉพาะ part กับค่าจ้าง ที่เป็นต้นทุน
ปกติ ต้องมีการต้องมีการโอนของจากคลังไปโรงงานด้วยเอกสาร TIP ด้วย ก่อนทำ Reports As Finish และ Costing Valve เสร็จก็ต้องมีเอกสารโอน Valve เสร็จคืนคลัง ตามขั้นตอน (ตัวอย่างนี้ไม่ได้สร้างเอกสารใบโอน)
14. ที่ PD Valve ที่เปิดอยู่จาก Shortage Update Estimation และ Job Scheduling Update ---> Start หรือทำ Packing list เองโดยสร้าง Packing list เข้าไปที่ Journals ---> Packing list สร้าง Create new line ขึ้นมา จองของ Reservation แล้ว Post
- Update Report As Finish
- Update Costing

WH
15. คลัง Post ส่งของออก SO ที่ Line ของ SO ใส WH , Location Tab Quantity ใส่ Deliver now จำนวนที่ของออก
16. จองของที่ Line Inventory ---> Reservation แล้ว Posting ---> Packing Slip

IF
17. ที่ Line ของ SO จะมี Invoice remainder ค้าง ใส่จำนวนที่จะ Invoice ที่ช่อง Deliver now แล้ว Posting ---> Invoice ดู Total จะเห็น ต้นทุนและกำไรเท่าไหร่
จบขั้นตอนการขาย

ผจ.
18. การ Adjustment เข้าไปที่ Inventory management ---> Periodic ---> Closing and adjustment คลิ๊ก Adjustment ---> Transactions ---> Select
ใส่ item Part ที่ต้องการ Adjust ใส่ช่อง Edit now(ใส่ค่าต้องการการให้เพิ่มหรือลบ เช่น +50 -50 ต้องการให้ต้นทุ่นเพิ่ม50 หรือ ลดลง 50) แล้ว Post ใส่รายละเอียดเพิ่มเติม

***** หมายเหตุ การ Adjust*****
จะมีผลก็ต่อเมื่อมีการ Recalculation
- เปลี่ยนต้นทุนหมด ทั้ง PO, PD , Valve, Stockcard
- แต่ต้องมีการ Recalculation ด้วย (ถ้าเป็น Valve ต้อง Recalculation part ด้วย Recall เฉพาะ Valve ต้นทุนไม่เปลี่ยน)

แต่ถ้าไม่ Recalculation
- จะเปลี่ยนเฉพาะ PO หรือ PD item นั้น ๆ ที่ถูก Adjust

Alfresco : Add user to Alfresco.

Alfresco : Add user to Alfresco.

1. http://alfresco.sci.com Login by admin permission IT.
2. Click Top Menu Administrator Console.
3. Click Manage User Groups.
4. Select group and add new user.
5. Go to folder example Drawing. Click More Action and click Manage Space Users.
6. Add user and set permission to folder.

Add user to folder or add to group example add user to group DS user have permission all folder Drawing.

PHP : SQL set null value to database.

PHP : SQL set null value to database.
Example :
   $query = "INSERT INTO uradmonitor (db_value1, db_value2) VALUES (".
        (($val1=='')?"NULL":("'".$val1."'")) . ", ".
        (($val2=='')?"NULL":("'".$val2."'")) .
        ")";
    $result = mysql_query($query);
 
 
$SQL     = "INSERT INTO sci_rp.RPHeader(RPID, RequestDate, CreateDate, Creator, PREmployee, RPSupervisor, RPManager, PRSupervisor, PRManager, Director, Status, RequestLevel, EndDate) ";
$SQL    .= " VALUES('".$NewID."','".$RequestDate."','".$CreateDate."','".$CreatorEmpId."',".(($PREmployee=='')?"NULL":("'".$PREmployee."'")).",".(($RPSupervisor=='')?"NULL":("'".$RPSupervisor."'")).",".(($RPManager=='')?"NULL":("'".$RPManager."'")).",".(($PRSupervisor=='')?"NULL":("'".$PRSupervisor."'")).",".(($PRManager=='')?"NULL":("'".$PRManager."'")).",".(($Director=='')?"NULL":("'".$Director."'")).",'".$Status."','".$HeaderData["RequestLevel"]."',".(($EndDate=='')?"NULL":("'".$EndDate."'")).")";
$myDB->Update($SQL);
 
Or use this method.
- Create tmp table in database. By copy table to new table by structure only.
- User SQL INSERT(SELECT * FROM ...)
Code Example :
 
$SQL     = "INSERT INTO sci_rp.RPHeader_tmp (SELECT * FROM sci_rp.RPHeader WHERE RPID='".$RPID."')";
$myDB->Update($SQL);
 
$SQL     = "UPDATE sci_rp.RPHeader_tmp SET RPID='".$NewID."' WHERE RPID='".$RPID."'";
$myDB->Update($SQL);
 
$SQL     = "INSERT INTO sci_rp.RPHeader(SELECT * FROM sci_rp.RPHeader_tmp WHERE RPID='".$NewID."')";
$myDB->Update($SQL);
$myDB->Update("DELETE FROM sci_rp.RPHeader_tmp WHERE RPID='".$NewID."'");
 
 

Bat Backup Database Axapta + Document + iXimple

Bat Backup Database Axapta + Document + iXimple
- Opent Notepad Save To .bat
- Run On Server Axapta.

Code
 
@echo off
For /f "tokens=2-4 delims=/ " %%a in ('date /t') do (set mydate=%%c-%%a-%%b)
For /f "tokens=1-2 delims=/:" %%a in ("%TIME%") do (set mytime=%%a%%b)
 
 
set database_name_2015=axdb_2015
set database_name_iXimple=iXimple
 
set backup_file_2015=x:\%database_name_2015%_%mydate%_%mytime%.bak
set backup_file_iXimple=x:\%database_name_iXimple%_%mydate%_%mytime%.bak
 
set list=W1 W2 W3 W4 W5 W6 W7 W8 W9 W10 W11 W12 W13 U1 U2 U3 U4 U5 U6 public
 
OSQL -H Axapta -U sa -P sciadminsql -Q "BACKUP DATABASE %database_name_2015% TO DISK = '%backup_file_2015%'"
OSQL -H Axapta -U sa -P sciadminsql -Q "BACKUP DATABASE %database_name_iXimple% TO DISK = '%backup_file_iXimple%'"
 
IF %ERRORLEVEL% EQU 0 (
    for %%S in (%list%) do (
        echo Checking box %%S
        if exist \\192.168.2.77\%%S\ (
            echo %%S found
 
        xcopy /y %backup_file_2015% \\192.168.2.77\%%S\
        IF %ERRORLEVEL% EQU 0 del %backup_file_2015%   
 
        xcopy /y %backup_file_iXimple% \\192.168.2.77\%%S\
        IF %ERRORLEVEL% EQU 0 del %backup_file_iXimple%
 
        C:\WINDOWS\system32\ntbackup.exe backup "@C:\Documents and Settings\Administrator\Local Settings\Application Data\Microsoft\Windows NT\NTBackup\data\BackUpAxaptaFile.bks" /n "Axapta_.bkf created 9/7/2558 at 9:11" /d "Set created 9/7/2558 at 9:11" /v:yes /r:no /rs:no /hc:off /m normal /j "BackUpAxaptaFile" /l:s /f "X:\Axapta_.bkf"
        IF %ERRORLEVEL% EQU 0 xcopy /y X:\Axapta_.bkf \\192.168.2.77\%%S\
        IF %ERRORLEVEL% EQU 0 del X:\Axapta_.bkf
        GOTO :THEEND
        ) else (
            echo  %%S NOT exist
        )
    )
)
:THEEND