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));
    }

     

  • 相关阅读:
    URL中的特殊字符 + % # & = ? /
    mvc 前端显示文本中的html标签处理
    URL中#号(井号)的作用
    自定义配置节 Section
    vshost.exe.config与.exe.config ;Debug目录与Release目录;bin目录与obj目录
    在MVC过滤器中获取触发的Controller、Action、参数 等
    js设置全局变量 ajax中赋值
    批处理 安装、卸载 window service
    [摘]HttpContext, HttpRequest, HttpResponse, HttpRuntime, HttpServerUtility
    摘要:ASP.NET的路由
  • 原文地址:https://www.cnblogs.com/Fandyx/p/2027655.html
Copyright © 2011-2022 走看看