Beispiel #1
0
 private void Insert_Det(int docId, string docNo, string docType, int index, decimal price, string code, string cntNo, string jobNo, string tripId)
 {
     try
     {
         //string sql = string.Format(@"select count(*) from XAApPaymentDet where PayId={0} and JobRefNo='{1}' and ", docId,tripId);
         //int n = SafeValue.SafeInt(ConnectSql.ExecuteScalar(sql),0);
         //if (n == 0)
         //{
         C2.XAApPaymentDet det = new C2.XAApPaymentDet();
         det.DocDate   = new DateTime(1900, 1, 1);
         det.DocId     = docId;
         det.DocNo     = docNo;
         det.PayId     = docId;
         det.PayNo     = docNo;
         det.DocType   = docType;
         det.PayLineNo = index;
         det.AcCode    = System.Configuration.ConfigurationManager.AppSettings["DefaultLineCode"];
         if (code == "WASHING" || code == "DETENTION")
         {
             det.AcCode = "200103";
         }
         det.AcSource  = "DB";
         det.Remark1   = code;
         det.Remark2   = "";
         det.Remark3   = cntNo;
         det.MastRefNo = jobNo;
         det.JobRefNo  = tripId;
         det.Currency  = System.Configuration.ConfigurationManager.AppSettings["Currency"];
         det.ExRate    = 1;
         det.DocAmt    = price;
         if (det.ExRate == 0)
         {
             det.ExRate = 1;
         }
         det.LocAmt = price;
         C2.Manager.ORManager.StartTracking(det, Wilson.ORMapper.InitialState.Inserted);
         C2.Manager.ORManager.PersistChanges(det);
         //}
     }
     catch
     {
     }
 }
Beispiel #2
0
    private void InsertPay_Det(int docId, string docNo, string docType, int index, string code, string refNo, string des, decimal qty, decimal price, string cur, decimal exRate, decimal gst, string billType, string billNo, string mastType, string cntNo, DateTime docDate)
    {
        try
        {
            C2.XAApPaymentDet det = new C2.XAApPaymentDet();
            det.PayNo     = docId.ToString();
            det.PayId     = docId;
            det.DocId     = 0;
            det.PayLineNo = index;
            det.DocNo     = docNo;
            det.DocDate   = docDate;
            det.DocType   = docType;
            det.AcCode    = "20";
            det.AcSource  = "DB";
            det.MastRefNo = refNo;
            det.JobRefNo  = "";


            det.Remark1  = code;
            det.Remark2  = des;
            det.Remark3  = cntNo;
            det.DocAmt   = price;
            det.Currency = cur;
            det.ExRate   = 1;

            if (det.ExRate == 0)
            {
                det.ExRate = 1;
            }
            decimal locAmt = SafeValue.ChinaRound(price * det.ExRate, 2);
            det.DocAmt = price;
            det.LocAmt = locAmt;
            C2.Manager.ORManager.StartTracking(det, Wilson.ORMapper.InitialState.Inserted);
            C2.Manager.ORManager.PersistChanges(det);
        }
        catch
        {
        }
    }
Beispiel #3
0
 private void Update_Det(XAApPayment inv, int index, decimal price, string code, string cntNo, string jobNo, string tripId)
 {
     try
     {
         string sql = string.Format(@"select SequenceId from XAApPaymentDet where Remark1='{0}'", code);
         int    id  = SafeValue.SafeInt(Helper.Sql.One(sql), 0);
         Wilson.ORMapper.OPathQuery query = new Wilson.ORMapper.OPathQuery(typeof(C2.XAApPaymentDet), "SequenceId=" + id + "");
         C2.XAApPaymentDet          det   = C2.Manager.ORManager.GetObject(query) as C2.XAApPaymentDet;
         if (det != null)
         {
             det.DocDate   = new DateTime(1900, 1, 1);
             det.PayId     = inv.SequenceId;
             det.PayNo     = inv.DocNo;
             det.DocType   = inv.DocType;
             det.PayLineNo = index;
             det.AcCode    = System.Configuration.ConfigurationManager.AppSettings["DefaultCash"];
             det.AcSource  = "DB";
             det.Remark1   = code;
             det.Remark2   = "";
             det.Remark3   = cntNo;
             det.MastRefNo = jobNo;
             det.JobRefNo  = tripId;
             det.Currency  = System.Configuration.ConfigurationManager.AppSettings["Currency"];
             det.ExRate    = 1;
             det.DocAmt   += price;
             if (det.ExRate == 0)
             {
                 det.ExRate = 1;
             }
             det.LocAmt = price;
             C2.Manager.ORManager.StartTracking(det, Wilson.ORMapper.InitialState.Updated);
             C2.Manager.ORManager.PersistChanges(det);
         }
     }
     catch
     {
     }
 }