zoukankan      html  css  js  c++  java
  • Using X++ Code batch Terminate and copy the purchase price

    Sometimes,The purchasing staff would like to Batch Terminate and copy the purchase price on Trade agrement - > Purchase prices.

    So,I wrote a batch jobs used to solve this problem!

    Wrote by Jimmy on April 25th 2011

     

    static void Jimmy_PriceChangeVendorAndCopyPrice(Args _args)
    {
    int i;
    priceDiscTable priceDiscTable,insetPriceDS;
    test test;
    Transdate Todate
    = systemdateget() - 1;
    Transdate FromDate
    = systemdateget();
    ;

    while select test order by ItemId
    {
    ttsbegin;
    while select forupdate priceDiscTable
    where priceDiscTable.ItemCode == TableGroupAll::Table
    && priceDiscTable.AccountCode == TableGroupAll::Table
    && priceDiscTable.relation == PriceType::PricePurch
    && priceDiscTable.Module == ModuleInventCustVend::Vend
    //&& priceDiscTable.QVS_Default == Noyes::No
    && priceDiscTable.AccountRelation == "30076"
    && priceDiscTable.ItemRelation == test.ItemId
    && (systemdateget() >= PriceDiscTable.fromDate || !PriceDiscTable.fromDate) &&
    (systemdateget()
    <= PriceDiscTable.toDate || !PriceDiscTable.toDate)
    {
    i
    ++;
    insetPriceDS.data(priceDiscTable);
    insetPriceDS.AccountRelation
    = "35033";
    insetPriceDS.FromDate
    = FromDate;
    insetPriceDS.Comment
    = "Copy 30076 price by Jimmy Xie";
    insetPriceDS.modifiedField(fieldnum(priceDiscTable,AccountRelation));
    insetPriceDS.insert();

    priceDiscTable.QVS_Default
    = Noyes::No;
    priceDiscTable.ToDate
    = Todate;
    priceDiscTable.Comment
    = "Terminate 30076 price by Jimmy Xie";
    priceDiscTable.modifiedField(fieldnum(priceDiscTable,QVS_Default));
    priceDiscTable.update();

    }
    ttscommit;
    }

    /*update main vendor account and purchase group
    while select test order by ItemId
    {
    ttsbegin;
    while select forupdate priceDiscTable
    where priceDiscTable.ItemCode == TableGroupAll::Table
    && priceDiscTable.AccountCode == TableGroupAll::Table
    && priceDiscTable.relation == PriceType::PricePurch
    && priceDiscTable.Module == ModuleInventCustVend::Vend
    && priceDiscTable.QVS_Default == Noyes::Yes
    && priceDiscTable.AccountRelation == "35033"
    && priceDiscTable.ItemRelation == test.ItemId
    //&& priceDiscTable.Comment == "Terminate 30076 price by Jimmy Xie"
    && priceDiscTable.FromDate == todatys
    && (systemdateget() >= PriceDiscTable.fromDate || !PriceDiscTable.fromDate) &&
    (systemdateget() <= PriceDiscTable.toDate || !PriceDiscTable.toDate)
    {
    i++;
    priceDiscTable.modifiedField(fieldnum(priceDiscTable,QVS_Default));
    priceDiscTable.update();

    }
    ttscommit;
    }
    */
    info(int2str(i));
    }

     

  • 相关阅读:
    Java实现蓝桥杯七对数字
    Java实现蓝桥杯七对数字
    ubuntu下交叉编译windows c程序
    Linux下开发Windows平台运行的程序
    Fedora 11中用MinGW编译Windows的Qt4程序(在Linux系统下编译Windows的程序)
    C++内存问题大集合(指针问题,以及字符串拷贝问题,确实挺危险的)
    C/C++的编译器|编译环境(非常全面的比较)
    关于 js 中的 call 和 apply使用理解
    看我如何应对业务需求变化,领域模型调整?
    MVC 用扩展方法执行自定义视图,替代 UIHint
  • 原文地址:https://www.cnblogs.com/Fandyx/p/2027655.html
Copyright © 2011-2022 走看看