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

     

  • 相关阅读:
    workflow里xaml格式(备忘)
    Excel 读取
    自定义工作流活动的外观的两种方式(补充)
    用SQLite,Enterprise的报错
    WF 4.0
    升级 90天 vs2008 在win2008下。
    NUnitLite web下的用法
    screen常用方法 Lei
    中文摘要的写法 Lei
    bootstrap, boosting, bagging 几种方法的联系 Lei
  • 原文地址:https://www.cnblogs.com/Fandyx/p/2027655.html
Copyright © 2011-2022 走看看