コード例 #1
0
        //    public QuotationDetailDataPageDelete()
        //        : base("Follow", "foll_FollowID", "FollowNewEntry")
        //    {
        //        this.CancelButton = false;
        //        this.DeleteButton = false;
        //    }

        public override void BuildContents()
        {
            try
            {
                AddContent(HTML.Form());
                string qutaid = Dispatch.EitherField("quta_Quotationid");
                if (string.IsNullOrEmpty(qutaid))
                {
                    qutaid = Dispatch.EitherField("key37");
                }
                string     QuotationDetailid = Dispatch.EitherField("qtdt_QuotationDetailID");
                Record     rec = FindRecord("QuotationDetail", "qtdt_QuotationDetailID=" + QuotationDetailid);
                EntryGroup QuotationDetailentry = new EntryGroup("QuotationDetailNewEntry");
                QuotationDetailentry.Fill(rec);
                AddTabHead("QuotationDetail");
                //GetTabs("QuotationDetail", "QuotationDetail");
                string hMode = Dispatch.EitherField("HiddenMode");
                if (hMode == "Save")
                {
                    Record qutarec = FindRecord("Quotation", "quta_Quotationid=" + qutaid);
                    string oppoid  = qutarec.GetFieldAsString("quta_opportunityid");
                    //Record rec =  base.FindCurrentRecord("QuotationDetail");

                    double      thislocal = rec.GetFieldAsDouble("qtdt_localeamount");
                    QuerySelect qs        = this.GetQuery();
                    qs.SQLCommand = "Update Opportunity set oppo_qutaprice = case when (ISNULL(oppo_qutaprice," + thislocal + ")-" + thislocal + ") < 0 then 0 else (ISNULL(oppo_qutaprice," + thislocal + ")-" + thislocal + ") end  where Oppo_OpportunityId =" + oppoid;
                    qs.ExecuteNonQuery();

                    rec.DeleteRecord = true;
                    string code = rec.GetFieldAsString("qtdt_code");
                    rec.SaveChanges();

                    //
                    qs.SQLCommand = "Update QuotationDetail set qtdt_code=qtdt_code-1 where qtdt_code >'" + code + "' and qtdt_deleted is null and qtdt_qutaid =" + qutaid;
                    qs.ExecuteNonQuery();

                    qs.SQLCommand = @"Update Quotation set quta_localeamount = (select sum(qtdt_localeamount) from QuotationDetail where qtdt_deleted is null and qtdt_qutaid= " + qutaid + @")
                        ,quta_foreignamount =  (select sum(qtdt_foreignamount) from QuotationDetail where qtdt_deleted is null and qtdt_qutaid= " + qutaid + @")    where quta_Quotationid=" + qutaid;
                    qs.ExecuteNonQuery();
                    Dispatch.Redirect(UrlDotNet(ThisDotNetDll, "RunDataPage") + "&quta_Quotationid=" + qutaid);
                }


                /* Add your code here */

                AddContent(HTML.InputHidden("HiddenMode", ""));
                QuotationDetailentry.GetHtmlInViewMode(rec);
                AddContent(QuotationDetailentry);
                AddSubmitButton("确认删除", "delete.gif", "javascript:document.EntryForm.HiddenMode.value='Save';");
                AddUrlButton("Cancel", "Cancel.gif", UrlDotNet(ThisDotNetDll, "RunDataPage") + "&quta_Quotationid=" + qutaid);
            }
            catch (Exception error)
            {
                this.AddError(error.Message);
            }
        }
コード例 #2
0
 public override void BuildContents()
 {
     try {
         /*查找当前数据库中该产品最新价格
          *必须在该条记录保存前查询 */
         QuerySelect qs                = this.GetQuery();
         string      productinfoid     = Dispatch.ContentField("qtdt_productinfoid");
         double      thislocalaount    = Convert.ToDouble(Dispatch.ContentField("qtdt_localeamount"));
         double      thisforeignamount = Convert.ToDouble(Dispatch.ContentField("qtdt_foreignamount"));
         string      select            = @"select qtdt_localeamount,qtdt_foreignamount,quta_opportunityid from  QuotationDetail where qtdt_UpdatedDate =
                 (select MAX( qtdt_UpdatedDate) from QuotationDetail 
                 left join Quotation on quta_QuotationID = qtdt_qutaid
                 left join Opportunity on Oppo_OpportunityId = quta_opportunityid  
                 where qtdt_productinfoid = " + productinfoid + @" and quta_opportunityid = 12 and Oppo_Deleted is null and quta_Deleted is null and qtdt_Deleted is null) ";
         qs.SQLCommand = select;
         qs.ExecuteReader();
         double qtdt_localeamount = 0, qtdt_foreignamount = 0;
         string quta_opportunityid = string.Empty;
         if (!qs.Eof())
         {
             qtdt_localeamount  = Convert.ToDouble(qs.FieldValue("qtdt_localeamount"));
             qtdt_foreignamount = Convert.ToDouble(qs.FieldValue("qtdt_foreignamount"));
             quta_opportunityid = qs.FieldValue("quta_opportunityid");
         }
         double resultlocal   = thislocalaount - qtdt_localeamount;
         double resultforeign = thisforeignamount = qtdt_foreignamount;
         string updatesql     = @"update Opportunity set oppo_qutaprice = ISNULL(oppo_qutaprice,0) + " + resultlocal + " where Oppo_OpportunityId =" + quta_opportunityid;
         qs.SQLCommand = updatesql;
         qs.ExecuteNonQuery();
     }
     catch (Exception ex)
     {
         AddError(ex.Message);
     }
 }
コード例 #3
0
ファイル: EntityDataPageNew.cs プロジェクト: Cross985/XXGJ2.0
        public override void AfterSave(EntryGroup screen)
        {
            //Record FollRec = base.FindCurrentRecord("Follow");
            //screen.Fill(FollRec);
            //FollRec.SaveChanges();
            Record      foll   = screen.getRecord;
            string      id     = foll.RecordId.ToString();
            string      compid = foll.GetFieldAsString("foll_companyid");
            string      date   = foll.GetFieldAsDateTime("foll_followdate").ToString("yyyy-MM-dd");
            QuerySelect qs     = this.GetQuery();

            qs.SQLCommand = "select comp_shortname from Company where comp_companyid = " + compid;
            qs.ExecuteReader();
            string code = qs.FieldValue("comp_shortname");
            string name = code + "/" + date;

            qs.SQLCommand = "update Follow set foll_Name = '" + name + "' where foll_followid =" + id;
            qs.ExecuteNonQuery();
            string foll_createoppo = foll.GetFieldAsString("foll_createoppo");

            if (foll_createoppo.ToLower() == "y")
            {
                Dispatch.Redirect(Url("1190"));
            }
            else
            {
                Dispatch.Redirect(UrlDotNet("Company", "RunFollowList") + "&123&comp_companyid=" + compid + "&J=Follow&T=Company");
            }
        }
コード例 #4
0
        public override void BuildContents()
        {
            AddContent(HTML.Form());
            try {
                string     hMode              = Dispatch.EitherField("HiddenMode");
                string     id                 = Dispatch.EitherField("optr_OppoTrackId");
                int        errorflag          = 0;
                string     errormessage       = string.Empty;
                Record     OppoTrack          = FindRecord("OppoTrack", "optr_OppoTrackId=" + id);
                string     optr_opportunityid = OppoTrack.GetFieldAsString("optr_opportunityid");
                string     oppoid             = Dispatch.EitherField("key7");
                EntryGroup OppoTrackNewEntry  = new EntryGroup("OppoTrackNewEntry");
                OppoTrackNewEntry.Fill(OppoTrack);

                AddTabHead("Delete OppoTrack");
                if (hMode == "Delete")
                {
                    OppoTrack.DeleteRecord = true;
                    OppoTrack.SaveChanges();

                    QuerySelect qs = this.GetQuery();
                    qs.SQLCommand = @"Update Opportunity set oppo_nexttrackdate = (select MAX(optr_nexttrackdate) from OppoTrack where optr_deleted is null and optr_opportunityid=" + optr_opportunityid + @")
                        ,oppo_trackdate = (select MAX(optr_date) from OppoTrack where optr_deleted is null and optr_opportunityid=" + optr_opportunityid + @" )
                        ,oppo_targetclose = (select optr_targetclose  from OppoTrack where optr_OppoTrackId = " + OppoTrack.RecordId.ToString() + @" )
                        ,oppo_forecast = (select optr_forecast from OppoTrack where optr_OppoTrackId = " + OppoTrack.RecordId.ToString() + @") 
                        ,oppo_certainty = (select optr_certainty  from OppoTrack where optr_OppoTrackId = " + OppoTrack.RecordId.ToString() + @") where oppo_opportunityid=" + optr_opportunityid;
                    qs.ExecuteNonQuery();

                    string url = string.Empty;
                    if (string.IsNullOrEmpty(oppoid))
                    {
                        url = UrlDotNet("SalesMenu", "RunOppoTrack") + "&J=OppoTrack&T=SalesManagement";
                    }
                    else
                    {
                        url = UrlDotNet(ThisDotNetDll, "RunListPage") + "&J=OppoTrack&T=Opportunity";
                    }
                    Dispatch.Redirect(url);
                }
                if (errorflag != -1)
                {
                    AddContent(HTML.InputHidden("HiddenMode", ""));
                    VerticalPanel vpMainPanel = new VerticalPanel();
                    vpMainPanel.AddAttribute("width", "100%");
                    string sUrl = "javascript:document.EntryForm.HiddenMode.value='Delete';";
                    OppoTrackNewEntry.GetHtmlInViewMode(OppoTrack);
                    vpMainPanel.Add(OppoTrackNewEntry);
                    AddContent(vpMainPanel);
                    AddSubmitButton("ConfirmDelete", "Delete.gif", sUrl);
                    string url = UrlDotNet(ThisDotNetDll, "RunDataPage") + "&optr_OppoTrackId=" + id + "&J=Summary";
                    AddUrlButton("Cancel", "cancel.gif", url);
                }
            } catch (Exception e) {
                AddError(e.Message);
            }
        }
コード例 #5
0
 public override void BuildContents()
 {
     try
     {
         AddContent(HTML.Form());
         string     qutaid        = Dispatch.EitherField("quta_Quotationid");
         EntryGroup qutacompEntry = new EntryGroup("QuotationCompanyEntry");
         qutacompEntry.Title = "商机客户";
         EntryGroup qutaEntry = new EntryGroup("QuotationNewEntry");
         qutaEntry.Title = "报价信息";
         Record qutaRec = FindRecord("Quotation", "quta_Quotationid=" + qutaid);
         qutacompEntry.Fill(qutaRec);
         qutaEntry.Fill(qutaRec);
         AddTabHead("Quotation");
         int    errflag = 0;
         string hMode   = Dispatch.EitherField("HiddenMode");
         if (hMode == "Save")
         {
             if (qutaEntry.Validate() == true && qutacompEntry.Validate())
             {
                 qutaEntry.Fill(qutaRec);
                 qutacompEntry.Fill(qutaRec);
                 string quta_opportunityid = qutaRec.GetFieldAsString("quta_opportunityid");
                 string quta_updateoppo    = qutaRec.GetFieldAsString("quta_updateoppo");
                 if (quta_updateoppo.ToLower() == "y")
                 {
                     QuerySelect qs = this.GetQuery();
                     qs.SQLCommand = "Update Opportunity set oppo_qutaprice= (select sum(quta_localeamount) from Quotation where quta_deleted is null and quta_updateoppo = 'Y' and quta_opportunityid = " + quta_opportunityid + " ) where oppo_Opportunityid =" + quta_opportunityid;
                     qs.ExecuteNonQuery();
                 }
                 qutaRec.SaveChanges();
                 Dispatch.Redirect(UrlDotNet(ThisDotNetDll, "RunDataPage") + "&quta_Quotationid=" + qutaid);
             }
         }
         if (errflag != -1)
         {
             AddContent(HTML.InputHidden("HiddenMode", ""));
             qutacompEntry.GetHtmlInEditMode(qutaRec);
             qutaEntry.GetHtmlInEditMode(qutaRec);
             VerticalPanel vp = new VerticalPanel();
             vp.AddAttribute("width", "100%");
             vp.Add(qutacompEntry);
             vp.Add(qutaEntry);
             AddContent(vp);
             AddSubmitButton("Save", "Save.gif", "javascript:document.EntryForm.HiddenMode.value='Save';");
             AddUrlButton("Delete", "Delete.gif", UrlDotNet(ThisDotNetDll, "RunDataPageDelete") + "&quta_Quotationid=" + qutaid);
             AddUrlButton("Cancel", "Cancel.gif", UrlDotNet(ThisDotNetDll, "RunDataPage") + "&quta_Quotationid=" + qutaid);
         }
     }
     catch (Exception error)
     {
         this.AddError(error.Message);
     }
 }
コード例 #6
0
ファイル: EntityDataPageNew.cs プロジェクト: Cross985/XXGJ2.0
        public override void AfterSave(Sage.CRM.Controls.EntryGroup screen)
        {
            Record Rec = screen.getRecord;

            screen.Fill(Rec);
            Rec.SaveChanges();
            string      startdate = Rec.GetFieldAsDateTime("mopl_startdate").ToString("yyyy-MM-dd");
            string      userid    = Rec.GetFieldAsString("mopl_userid");
            QuerySelect qs        = this.GetQuery();

            qs.SQLCommand = "select user_LastName from Users where user_userid=" + userid;
            qs.ExecuteReader();
            string username = qs.FieldValue("user_LastName");
            string name     = username + "/" + startdate;

            qs.SQLCommand = "Update MonthPlan set mopl_Name ='" + name + "' where mopl_MonthPlanid =" + Rec.RecordId.ToString();
            qs.ExecuteNonQuery();
            base.AfterSave(screen);
        }
コード例 #7
0
        public override void BuildContents()
        {
            try
            {
                AddContent(HTML.Form());
                string qutaid = Dispatch.EitherField("quta_Quotationid");
                if (string.IsNullOrEmpty(qutaid))
                {
                    qutaid = Dispatch.EitherField("key58");
                }

                EntryGroup qutacompEntry = new EntryGroup("QuotationCompanyEntry");
                qutacompEntry.Title = "商机客户";
                EntryGroup qutaEntry = new EntryGroup("QuotationNewEntry");
                qutaEntry.Title = "报价信息";
                Record qutaRec = FindRecord("Quotation", "quta_Quotationid=" + qutaid);
                qutacompEntry.Fill(qutaRec);
                qutaEntry.Fill(qutaRec);
                GetTabs("Quotation", "Quotation Summary");
                string hMode = Dispatch.EitherField("HiddenMode");
                string quta_opportunityid = qutaRec.GetFieldAsString("quta_opportunityid");
                if (hMode == "Delete")
                {
                    qutaRec.DeleteRecord = true;
                    qutaRec.SaveChanges();

                    QuerySelect qs = this.GetQuery();
                    if (!string.IsNullOrEmpty(quta_opportunityid))
                    {
                        qs.SQLCommand = "Update Opportunity set oppo_qutaprice= (select sum(quta_localeamount) from Quotation where quta_deleted is null and quta_updateoppo = 'Y' and quta_opportunityid = " + quta_opportunityid + " ) where oppo_Opportunityid =" + quta_opportunityid;
                        qs.ExecuteNonQuery();
                    }
                    qs.SQLCommand = "Update QuotationDetail set qtdt_deleted = '1' where qtdt_qutaid =" + qutaid;
                    qs.ExecuteNonQuery();
                    Dispatch.Redirect(UrlDotNet(ThisDotNetDll, "RunListPage") + "&J=Quotation&T=Opportunity");
                }



                AddContent(HTML.InputHidden("HiddenMode", ""));
                qutacompEntry.GetHtmlInViewMode(qutaRec);
                qutaEntry.GetHtmlInViewMode(qutaRec);
                VerticalPanel vp = new VerticalPanel();
                vp.AddAttribute("width", "100%");
                vp.Add(qutacompEntry);
                vp.Add(qutaEntry);


                AddContent(vp);

                string url = string.Empty;

                url = UrlDotNet(ThisDotNetDll, "RunDataPage") + "&quta_Quotationid=" + qutaid + "&J=OppoTrack&T=Opportunity";
                AddSubmitButton("ConfirmDelete", "Delete.gif", "javascript:document.EntryForm.HiddenMode.value='Delete';");
                AddUrlButton("Cancel", "Cancel.gif", url);
            }
            catch (Exception error)
            {
                this.AddError(error.Message);
            }
        }
コード例 #8
0
ファイル: QDAdd.cs プロジェクト: Cross985/XXGJ
        public override void BuildContents()
        {
            try
            {
                AddContent(HTML.Form());

                string qutaid   = Dispatch.EitherField("quta_Quotationid");
                Record QutaRec  = FindRecord("Quotation", "quta_Quotationid=" + qutaid);
                string exchange = QutaRec.GetFieldAsString("quta_exchange");
                if (string.IsNullOrEmpty(exchange) || exchange == "0")
                {
                    exchange = "1";
                }
                string currency = QutaRec.GetFieldAsString("quta_currencysid");
                if (!string.IsNullOrEmpty(currency))
                {
                    Record currRec  = FindRecord("Currencys", "curr_CurrencysId=" + currency);
                    string currname = currRec.GetFieldAsString("curr_des");
                    AddContent(HTML.InputHidden("currency", currname));
                }


                AddContent(HTML.InputHidden("exchange", exchange));
                string     hMode   = Dispatch.EitherField("HiddenMode");
                EntryGroup QDEntry = new EntryGroup("QuotationDetailNewEntry");
                QDEntry.Title = "报价明细";
                int errflag = 0;
                AddTabHead("QuotationDetail");
                if (hMode == "Save")
                {
                    Record QDRec = new Record("QuotationDetail");
                    QDEntry.Fill(QDRec);
                    if (QDEntry.Validate() == true)
                    {
                        QDRec.SetField("qtdt_qutaid", qutaid);
                        QDRec.SaveChanges();

                        QuerySelect qs = this.GetQuery();
                        qs.SQLCommand = @"Update Quotation set quta_localeamount = (select sum(qtdt_localeamount) from QuotationDetail where qtdt_deleted is null and qtdt_qutaid= " + qutaid + @")
                        ,quta_foreignamount =  (select sum(qtdt_foreignamount) from QuotationDetail where qtdt_deleted is null and qtdt_qutaid= " + qutaid + @")    where quta_Quotationid=" + qutaid;
                        qs.ExecuteNonQuery();
                        Dispatch.Redirect(UrlDotNet(ThisDotNetDll, "RunDataPage") + "&quta_Quotationid=" + qutaid);
                    }
                }
                if (errflag != -1)
                {
                    AddContent(HTML.InputHidden("HiddenMode", ""));
                    QDEntry.GetHtmlInEditMode();
                    VerticalPanel vp = new VerticalPanel();
                    vp.AddAttribute("width", "100%");
                    vp.Add(QDEntry);
                    AddContent(vp);

                    string url = "javascript:document.EntryForm.HiddenMode.value='Save';";
                    AddSubmitButton("Save", "Save.gif", url);
                    AddUrlButton("Cancel", "cancel.gif", UrlDotNet(ThisDotNetDll, "RunDataPage") + "&quta_Quotationid=" + qutaid);
                }
            }
            catch (Exception ex)
            {
                AddError(ex.Message + "USAddPage");
            }
        }
コード例 #9
0
        public override void BuildContents()
        {
            try
            {
                AddContent(HTML.Form());

                EntryGroup qutacompEntry = new EntryGroup("QuotationCompanyEntry");
                qutacompEntry.Title = "商机客户";
                EntryGroup qutaEntry = new EntryGroup("QuotationNewEntry");
                qutaEntry.Title = "报价信息";
                string oppoid = Dispatch.EitherField("oppo_OpportunityId");
                if (string.IsNullOrEmpty(oppoid))
                {
                    oppoid = Dispatch.EitherField("key7");
                }
                AddTabHead("Quotation");
                int    errflag = 0;
                string errmsg  = string.Empty;
                string hMode   = Dispatch.EitherField("HiddenMode");
                if (hMode == "Save")
                {
                    Record QutaRec = new Record("Quotation");
                    qutacompEntry.Fill(QutaRec);
                    int days = Convert.ToInt32(Dispatch.ContentField("quta_days"));
                    if (days < 3)
                    {
                        //AddError(days.ToString());
                        errflag = 1;
                        errmsg  = "交货天数不可小于3天!";
                    }
                    string quta_oppoid   = Dispatch.ContentField("quta_opportunityid");
                    string quta_qutatype = Dispatch.ContentField("quta_qutatype");
                    if (string.IsNullOrEmpty(quta_oppoid) && quta_qutatype != "1" && quta_qutatype != "2")
                    {
                        errflag = 1;
                        errmsg  = "请选择商机!";
                    }


                    qutaEntry.Fill(QutaRec);
                    if (qutaEntry.Validate() == true && qutacompEntry.Validate() && errflag == 0)
                    {
                        string   code  = "C";
                        DateTime now   = DateTime.Now;
                        string   year  = now.Year.ToString();
                        string   month = now.Month.ToString();
                        string   day   = now.Day.ToString();
                        code += year + month + day;
                        QuerySelect qs = this.GetQuery();
                        qs.SQLCommand = "Select Count(*)+1 as cnt from Quotation where quta_code like '" + code + "%'";
                        qs.ExecuteReader();
                        int cnt = 0;
                        if (!qs.Eof())
                        {
                            cnt = Convert.ToInt32(qs.FieldValue("cnt"));
                        }
                        code += "9" + cnt.ToString().PadLeft(4, '0');

                        QutaRec.SetField("quta_code", code);
                        //QutaRec.SetField("quta_OpportunityId",oppoid);
                        QutaRec.SaveChanges();

                        //QuerySelect qs = this.GetQuery();
                        if ((quta_qutatype == "1" || quta_qutatype == "2") && string.IsNullOrEmpty(quta_oppoid))
                        {
                            //create opportunity
                            string opponame       = "报价单" + code + "自动生成商机";
                            string oppo_type      = "3";//订货
                            string oppo_countryin = Dispatch.ContentField("quta_type");
                            switch (oppo_countryin)
                            {
                            case "2101": oppo_countryin = "in";
                                break;

                            case "2102": oppo_countryin = "out";
                                break;

                            default: oppo_countryin = "in"; break;
                            }
                            string oppo_assigneduserid   = Dispatch.ContentField("quta_userid");
                            string oppo_stage            = "payment";
                            string oppo_status           = "In Progress";
                            string oppo_certainty        = "100";
                            string oppo_primarycompanyid = Dispatch.ContentField("quta_companyid");
                            Record OppoRec = new Record("Opportunity");
                            OppoRec.SetField("oppo_type", oppo_type);
                            OppoRec.SetField("oppo_description", opponame);
                            OppoRec.SetField("oppo_countryin", oppo_countryin);
                            OppoRec.SetField("oppo_assigneduserid", oppo_assigneduserid);
                            OppoRec.SetField("oppo_stage", oppo_stage);
                            OppoRec.SetField("oppo_status", oppo_status);
                            OppoRec.SetField("oppo_certainty", oppo_certainty);
                            OppoRec.SetField("oppo_primarycompanyid", oppo_primarycompanyid);
                            OppoRec.SetField("oppo_createdate", DateTime.Now);
                            OppoRec.SaveChanges();

                            quta_oppoid = OppoRec.RecordId.ToString();
                            QutaRec.SetField("quta_OpportunityId", quta_oppoid);
                            QutaRec.SaveChanges();
                        }

                        string quta_opportunityid = QutaRec.GetFieldAsString("quta_opportunityid");
                        qs.SQLCommand = "Update Opportunity set oppo_qutaprice= (select sum(quta_localeamount) from Quotation where quta_deleted is null and quta_updateoppo = 'Y' and quta_opportunityid = " + quta_opportunityid + " ) where oppo_Opportunityid =" + quta_opportunityid;
                        qs.ExecuteNonQuery();
                        Dispatch.Redirect(UrlDotNet(ThisDotNetDll, "RunDataPage") + "&quta_Quotationid=" + QutaRec.RecordId.ToString());
                    }
                }
                if (errflag != -1)
                {
                    if (errflag == 1)
                    {
                        AddError(errmsg);
                    }
                    AddContent(HTML.InputHidden("HiddenMode", ""));
                    qutacompEntry.GetHtmlInEditMode();
                    qutaEntry.GetHtmlInEditMode();
                    VerticalPanel vp = new VerticalPanel();
                    vp.AddAttribute("width", "100%");
                    vp.Add(qutacompEntry);
                    vp.Add(qutaEntry);
                    AddContent(vp);
                    AddSubmitButton("Save", "Save.gif", "javascript:document.EntryForm.HiddenMode.value='Save';");
                    string url = string.Empty;
                    if (string.IsNullOrEmpty(oppoid))
                    {
                        url = UrlDotNet("SalesMenu", "RunQuotation") + "&J=Quotation&T=SalesManagement";
                    }
                    else
                    {
                        url = UrlDotNet(ThisDotNetDll, "RunListPage") + "&J=OppoTrack&T=Opportunity";
                    }
                    AddUrlButton("Cancel", "Cancel.gif", url);
                }
            }
            catch (Exception error)
            {
                this.AddError(error.Message);
            }
        }
コード例 #10
0
ファイル: QDEdit.cs プロジェクト: Cross985/XXGJ2.0
        public override void BuildContents()
        {
            try
            {
                AddContent(HTML.Form());
                string     qdid    = Dispatch.EitherField("qtdt_QuotationDetailID");
                EntryGroup QDEntry = new EntryGroup("QuotationDetailNewEntry");
                QDEntry.Title = "报价明细";
                Record QDRec  = FindRecord("QuotationDetail", "qtdt_QuotationDetailID=" + qdid);
                string qutaid = Dispatch.EitherField("quta_Quotationid");
                if (string.IsNullOrEmpty(qutaid))
                {
                    qutaid = QDRec.GetFieldAsString("qtdt_qutaID");
                }
                Record QutaRec  = FindRecord("Quotation", "quta_Quotationid=" + qutaid);
                string exchange = QutaRec.GetFieldAsString("quta_exchange");
                if (string.IsNullOrEmpty(exchange) || exchange == "0")
                {
                    exchange = "1";
                }
                AddContent(HTML.InputHidden("exchange", exchange));
                string currency = QutaRec.GetFieldAsString("quta_currencysid");
                if (!string.IsNullOrEmpty(currency))
                {
                    Record currRec  = FindRecord("Currencys", "curr_CurrencysId=" + currency);
                    string currname = currRec.GetFieldAsString("curr_des");
                    AddContent(HTML.InputHidden("currency", currname));
                }


                string hMode = Dispatch.EitherField("HiddenMode");

                int errflag = 0;
                AddTabHead("QuotationDetail");
                //GetTabs("QuotationDetail", "QuotationDetail Summary");
                if (hMode == "Save")
                {
                    QDEntry.Fill(QDRec);
                    if (QDEntry.Validate() == true)
                    {
                        QDRec.SetField("quta_Quotationid", qutaid);

                        QDRec.SaveChanges();
                        QuerySelect qs             = this.GetQuery();
                        string      qtdtid         = QDRec.RecordId.ToString();
                        double      thislocalaount = Convert.ToDouble(Dispatch.ContentField("qtdt_localeamount"));
                        qs.SQLCommand = "exec crm_UpdateOpportunityQutaPrice @quotationid=" + qutaid;
                        qs.ExecuteNonQuery();
//                        string productinfoid = Dispatch.ContentField("qtdt_productinfoid");
//                        double thislocalaount = Convert.ToDouble(Dispatch.ContentField("qtdt_localeamount"));
//                        double thisforeignamount = Convert.ToDouble(Dispatch.ContentField("qtdt_foreignamount"));
//                        string select = @"select qtdt_localeamount,qtdt_foreignamount,quta_opportunityid from  QuotationDetail where qtdt_UpdatedDate =
//                        (select MAX( qtdt_UpdatedDate) from QuotationDetail
//                        left join Quotation on quta_QuotationID = qtdt_qutaid
//                        left join Opportunity on Oppo_OpportunityId = quta_opportunityid
//                        where qtdt_productinfoid = " + productinfoid + @" and quta_opportunityid = 12 and Oppo_Deleted is null and quta_Deleted is null and qtdt_Deleted is null) ";
//                        qs.SQLCommand = select;
//                        qs.ExecuteReader();
//                        double qtdt_localeamount = 0, qtdt_foreignamount = 0;
//                        string quta_opportunityid = string.Empty;
//                        if (!qs.Eof())
//                        {
//                            qtdt_localeamount = Convert.ToDouble(qs.FieldValue("qtdt_localeamount"));
//                            qtdt_foreignamount = Convert.ToDouble(qs.FieldValue("qtdt_foreignamount"));
//                            quta_opportunityid = qs.FieldValue("quta_opportunityid");
//                        }
//                        double resultlocal = thislocalaount - qtdt_localeamount;
//                        double resultforeign = thisforeignamount = qtdt_foreignamount;
//                        string updatesql = @"update Opportunity set oppo_qutaprice = ISNULL(oppo_qutaprice,0) + " + resultlocal + " where Oppo_OpportunityId =" + quta_opportunityid;
//                        qs.SQLCommand = updatesql;
//                        qs.ExecuteNonQuery();


                        //QuerySelect qs = this.GetQuery();
                        qs.SQLCommand = @"Update Quotation set quta_localeamount = (select sum(qtdt_localeamount) from QuotationDetail where qtdt_deleted is null and qtdt_qutaid= " + qutaid + @")
                        ,quta_foreignamount =  (select sum(qtdt_foreignamount) from QuotationDetail where qtdt_deleted is null and qtdt_qutaid= " + qutaid + @")    where quta_Quotationid=" + qutaid;
                        qs.ExecuteNonQuery();
                        Dispatch.Redirect(UrlDotNet(ThisDotNetDll, "RunDataPage") + "&quta_Quotationid=" + qutaid);
                    }
                }
                if (errflag != -1)
                {
                    AddContent(HTML.InputHidden("HiddenMode", ""));
                    QDEntry.GetHtmlInEditMode(QDRec);
                    VerticalPanel vp = new VerticalPanel();
                    vp.AddAttribute("width", "100%");
                    vp.Add(QDEntry);
                    AddContent(vp);

                    string url = "javascript:document.EntryForm.HiddenMode.value='Save';";
                    AddSubmitButton("Save", "Save.gif", url);
                    AddUrlButton("Delete", "Delete.gif", UrlDotNet(ThisDotNetDll, "RunQDDelete") + "&quta_Quotationid=" + qutaid + "&qtdt_QuotationDetailID=" + qdid);

                    AddUrlButton("Cancel", "cancel.gif", UrlDotNet(ThisDotNetDll, "RunDataPage") + "&quta_Quotationid=" + qutaid);
                }
            }
            catch (Exception ex)
            {
                AddError(ex.Message + "USAddPage");
            }
        }
コード例 #11
0
        public override void BuildContents()
        {
            AddContent(HTML.Form());

            try {
                string     hMode              = Dispatch.EitherField("HiddenMode");
                string     optr_OppoTrackId   = Dispatch.EitherField("optr_OppoTrackId");
                int        errorflag          = 0;
                string     errormessage       = string.Empty;
                Record     OppoTrack          = FindRecord("OppoTrack", "optr_OppoTrackId=" + optr_OppoTrackId);
                string     optr_opportunityid = OppoTrack.GetFieldAsString("optr_opportunityid");
                EntryGroup OppoTrackNewEntry  = new EntryGroup("OppoTrackNewEntry");
                OppoTrackNewEntry.Fill(OppoTrack);
                Entry optr_opportunityidEntry = OppoTrackNewEntry.GetEntry("optr_opportunityid");

                optr_opportunityidEntry.ReadOnly = true;

                //AddTabHead("CpetProduct");
                GetTabs("OppoTrack", "Summary");
                if (hMode == "Save")
                {
                    ////double original =CpetProduct.GetFieldAsDouble("");
                    OppoTrackNewEntry.Fill(OppoTrack);
                    ////double  =CpetProduct.GetFieldAsDouble("");

                    if (OppoTrackNewEntry.Validate())
                    {
                        OppoTrack.SaveChanges();

                        QuerySelect qs = this.GetQuery();
                        qs.SQLCommand = @"Update Opportunity set oppo_nexttrackdate = (select MAX(optr_nexttrackdate) from OppoTrack where optr_deleted is null and optr_opportunityid=" + optr_opportunityid + @")
                        ,oppo_trackdate = (select MAX(optr_date) from OppoTrack where optr_deleted is null and optr_opportunityid=" + optr_opportunityid + @" )
                        ,oppo_targetclose = (select optr_targetclose  from OppoTrack where optr_OppoTrackId = " + OppoTrack.RecordId.ToString() + @" )
                        ,oppo_forecast = (select optr_forecast from OppoTrack where optr_OppoTrackId = " + OppoTrack.RecordId.ToString() + @") 
                        ,oppo_certainty = (select optr_certainty  from OppoTrack where optr_OppoTrackId = " + OppoTrack.RecordId.ToString() + @") where oppo_opportunityid=" + optr_opportunityid;
                        qs.ExecuteNonQuery();

                        string url = UrlDotNet(ThisDotNetDll, "RunDataPage") + "&optr_OppoTrackId=" + optr_OppoTrackId + "&J=Summary";
                        Dispatch.Redirect(url);
                        errorflag = -1;
                    }
                    else
                    {
                        errorflag = 1;
                    }
                }
                if (errorflag != -1)
                {
                    AddContent(HTML.InputHidden("HiddenMode", ""));
                    VerticalPanel vpMainPanel = new VerticalPanel();
                    vpMainPanel.AddAttribute("width", "100%");
                    string sUrl = "javascript:document.EntryForm.HiddenMode.value='Save';";
                    OppoTrackNewEntry.GetHtmlInEditMode(OppoTrack);
                    vpMainPanel.Add(OppoTrackNewEntry);
                    AddContent(vpMainPanel);
                    AddSubmitButton("Save", "Save.gif", sUrl);
                    string urldelete = base.UrlDotNet(base.ThisDotNetDll, "RunDataPageDelete") + "&optr_OppoTrackId=" + optr_OppoTrackId;
                    base.AddUrlButton("Delete", "Delete.gif", urldelete);
                    string url = UrlDotNet(ThisDotNetDll, "RunDataPage") + "&optr_OppoTrackId=" + optr_OppoTrackId + "&J=Summary";
                    AddUrlButton("Cancel", "cancel.gif", url);
                }
            } catch (Exception e) {
                AddError(e.Message);
            }
        }
コード例 #12
0
        //public ContractDataPageDelete()
        //    : base("Contract", "cont_ContractId", "ContractNewEntry")
        //{
        //    this.EntryGroups[0].Title = "Contract";
        //    this.CancelMethod = "RunDataPage";
        //}
        public override void BuildContents()
        {
            AddContent(HTML.Form());
            try
            {
                string     hMode            = Dispatch.EitherField("HiddenMode");
                string     cont_ContractId  = Dispatch.EitherField("cont_ContractId");
                int        errorflag        = 0;
                string     errormessage     = string.Empty;
                Record     Contract         = FindRecord("Contract", "cont_ContractId=" + cont_ContractId);
                string     type             = Contract.GetFieldAsString("cont_type");
                EntryGroup ContractNewEntry = new EntryGroup("ContractNewEntry");
                ContractNewEntry.Fill(Contract);

                AddTabHead("Delete Contract");
                if (hMode == "Delete")
                {
                    Contract.DeleteRecord = true;
                    Contract.SaveChanges();
                    QuerySelect check = new QuerySelect();
                    check.SQLCommand = "delete contractdetail where code_contractid=" + cont_ContractId;
                    check.ExecuteNonQuery();

                    string url = UrlDotNet(ThisDotNetDll, "RunListPage");
                    Dispatch.Redirect(url);
                }
                if (errorflag != -1)
                {
                    AddContent(HTML.InputHidden("HiddenMode", ""));
                    VerticalPanel vpMainPanel = new VerticalPanel();
                    vpMainPanel.AddAttribute("width", "100%");

                    string sUrl = "javascript:document.EntryForm.HiddenMode.value='Delete';";
                    ContractNewEntry.GetHtmlInViewMode(Contract);
                    vpMainPanel.Add(ContractNewEntry);
                    if (type.ToLower() != "product")
                    {
                        List ContractDetailGrid = new List("ContractDetailGrid");
                        ContractDetailGrid.Filter                = "code_deleted is null and code_contractid=" + cont_ContractId + " and  code_isproduct='1'";
                        ContractDetailGrid.RowsPerScreen         = 500;
                        ContractDetailGrid.ShowNavigationButtons = true;
                        ContractDetailGrid.PadBottom             = false;
                        vpMainPanel.Add(ContractDetailGrid);
                    }
                    else
                    {
                        List ContractDetailProduct = new List("ContractDetailProduct");
                        ContractDetailProduct.Filter                = "code_deleted is null and code_contractid=" + cont_ContractId + " and code_isproduct='2'";
                        ContractDetailProduct.RowsPerScreen         = 500;
                        ContractDetailProduct.ShowNavigationButtons = true;
                        ContractDetailProduct.PadBottom             = false;
                        vpMainPanel.Add(ContractDetailProduct);
                    }
                    AddContent(vpMainPanel);
                    AddSubmitButton("ConfirmDelete", "Delete.gif", sUrl);
                    string url = UrlDotNet(ThisDotNetDll, "RunDataPage") + "&cont_ContractId=" + cont_ContractId + "&J=Summary";
                    url = url.Replace("Key37", "ContractDetailid");
                    url = url + "&Key37=" + cont_ContractId;
                    AddUrlButton("Cancel", "cancel.gif", url);
                }
            }
            catch (Exception e)
            {
                AddError(e.Message);
            }
        }
コード例 #13
0
ファイル: QDAdd.cs プロジェクト: Cross985/XXGJ2.0
        public override void BuildContents()
        {
            try
            {
                AddContent(HTML.Form());

                string qutaid   = Dispatch.EitherField("quta_Quotationid");
                Record QutaRec  = FindRecord("Quotation", "quta_Quotationid=" + qutaid);
                string exchange = QutaRec.GetFieldAsString("quta_exchange");
                if (string.IsNullOrEmpty(exchange) || exchange == "0")
                {
                    exchange = "1";
                }
                string currency = QutaRec.GetFieldAsString("quta_currencysid");
                if (!string.IsNullOrEmpty(currency))
                {
                    Record currRec  = FindRecord("Currencys", "curr_CurrencysId=" + currency);
                    string currname = currRec.GetFieldAsString("curr_des");
                    AddContent(HTML.InputHidden("currency", currname));
                }
                //报价单别 国内、国外
                string inout = QutaRec.GetFieldAsString("quta_type");

                AddContent(HTML.InputHidden("exchange", exchange));
                string     hMode   = Dispatch.EitherField("HiddenMode");
                EntryGroup QDEntry = new EntryGroup("QuotationDetailNewEntry");
                QDEntry.Title = "报价明细";
                int errflag = 0;
                AddTabHead("QuotationDetail");

                string productinfoid = Dispatch.ContentField("qtdt_productinfoid");
                double discount      = 100;
                if (!string.IsNullOrEmpty(productinfoid) && productinfoid != "0")
                {
                    Record prodRec = FindRecord("ProductInfo", "pdin_ProductInfoId=" + productinfoid);
                    string Name    = string.Empty;
                    if (inout == "2101")
                    {
                        Name = prodRec.GetFieldAsString("pdin_Name");
                    }
                    else
                    {
                        Name = prodRec.GetFieldAsString("pdin_Englishname");
                    }
                    string Standard         = prodRec.GetFieldAsString("pdin_standard");
                    string pdin_marketprice = prodRec.GetFieldAsString("pdin_marketprice");
                    //国内小类
                    string pdin_prodtypeid = prodRec.GetFieldAsString("pdin_prodtypeid");
                    if (string.IsNullOrEmpty(pdin_prodtypeid))
                    {
                        pdin_prodtypeid = "0";
                    }
                    //国外小类
                    string pdin_prodtype2 = prodRec.GetFieldAsString("pdin_prodtype2");
                    if (string.IsNullOrEmpty(pdin_prodtype2))
                    {
                        pdin_prodtype2 = "0";
                    }
                    //MOQ
                    string MOQ = prodRec.GetFieldAsString("pdin_moq");
                    if (string.IsNullOrEmpty(MOQ))
                    {
                        MOQ = "0";
                    }
                    //客户折扣 根据报价产品所属产品小类,确认客户该小类折扣
                    string      compid = QutaRec.GetFieldAsString("quta_companyid");
                    QuerySelect qs     = this.GetQuery();
                    qs.SQLCommand = "select prpi_discount from ProductPrice  where prpi_Deleted is null and prpi_Status = 'InProgress' and prpi_companyid = " + compid + " and (prpi_prodcategoryid  = " + pdin_prodtypeid + " or prpi_prodcategoryid = " + pdin_prodtype2 + ")";
                    qs.ExecuteReader();
                    if (qs.Eof())
                    {
                        discount = 100;
                    }
                    else
                    {
                        discount = Convert.ToDouble(qs.FieldValue("prpi_discount"));
                    }

                    //AddInfo(Name + "---" + Standard);

                    for (int i = 0; i < QDEntry.Count; i++)
                    {
                        string field = QDEntry[i].Name;
                        if (field == "qtdt_productname")
                        {
                            QDEntry[i].DefaultValue = Name;
                        }
                        else if (field == "qtdt_prodtype")
                        {
                            QDEntry[i].DefaultValue = Standard;
                        }
                        else if (field == "qtdt_discount")
                        {
                            QDEntry[i].DefaultValue = discount.ToString();
                        }
                        else if (field == "qtdt_price")
                        {
                            QDEntry[i].DefaultValue = pdin_marketprice;
                        }
                        else if (field == "qtdt_moq")
                        {
                            QDEntry[i].DefaultValue = MOQ;
                        }
                        else
                        {
                            QDEntry[i].DefaultValue = Dispatch.ContentField(QDEntry[i].Name);
                        }
                    }
                }
                //int errflag = 0;
                string errmsg = "";

                if (hMode == "Save")
                {
                    Record QDRec = new Record("QuotationDetail");
                    QDEntry.Fill(QDRec);
                    double dc = Convert.ToDouble(Dispatch.ContentField("qtdt_discount"));
                    if (dc < discount && discount != 100)
                    {
                        errflag = 1;
                        errmsg += "折扣率不可低于客户最低折扣!";
                    }
                    if (QDEntry.Validate() == true && errflag == 0)
                    {
                        QDRec.SetField("qtdt_qutaid", qutaid);

                        /*查找当前数据库中该产品最新价格
                         *必须在该条记录保存前查询 */
                        QuerySelect qs = this.GetQuery();

                        //string productinfoid = Dispatch.ContentField("qtdt_productinfoid");
                        double thislocalaount = Convert.ToDouble(Dispatch.ContentField("qtdt_localeamount"));


                        //double thisforeignamount = Convert.ToDouble(Dispatch.ContentField("qtdt_foreignamount"));
//                        string select = @"select qtdt_localeamount,qtdt_foreignamount,quta_opportunityid from  QuotationDetail where qtdt_UpdatedDate =
//                        (select MAX( qtdt_UpdatedDate) from QuotationDetail
//                        left join Quotation on quta_QuotationID = qtdt_qutaid
//                        left join Opportunity on Oppo_OpportunityId = quta_opportunityid
//                        where qtdt_productinfoid = " + productinfoid+@" and quta_opportunityid = 12 and Oppo_Deleted is null and quta_Deleted is null and qtdt_Deleted is null) ";
//                        qs.SQLCommand = select;
//                        qs.ExecuteReader();
//                        double qtdt_localeamount=0, qtdt_foreignamount=0;
//                        string quta_opportunityid = string.Empty;
//                        if (!qs.Eof())
//                        {
//                            qtdt_localeamount = Convert.ToDouble(qs.FieldValue("qtdt_localeamount"));
//                            qtdt_foreignamount = Convert.ToDouble(qs.FieldValue("qtdt_foreignamount"));
//                            quta_opportunityid = qs.FieldValue("quta_opportunityid");
//                        }
//                        double resultlocal = thislocalaount - qtdt_localeamount;
//                        double resultforeign = thisforeignamount = qtdt_foreignamount;
//                        string updatesql = @"update Opportunity set oppo_qutaprice = ISNULL(oppo_qutaprice,0) + "+resultlocal+" where Oppo_OpportunityId =" + quta_opportunityid;
//                        qs.SQLCommand = updatesql;
//                        qs.ExecuteNonQuery();


                        QDRec.SaveChanges();
                        string qtdtid = QDRec.RecordId.ToString();
                        qs.SQLCommand = "exec crm_UpdateOpportunityQutaPrice @quotationid=" + qutaid;
                        qs.ExecuteNonQuery();


                        //更新报价明细序号
                        qs.SQLCommand = "Update QuotationDetail set qtdt_code=(select count(*) from QuotationDetail where qtdt_deleted is null and qtdt_qutaid=" + qutaid + ") where qtdt_QuotationDetailId = " + qtdtid;
                        qs.ExecuteNonQuery();
                        //更新报价单上汇总价格
                        qs.SQLCommand = @"Update Quotation set quta_localeamount = (select sum(qtdt_localeamount) from QuotationDetail where qtdt_deleted is null and qtdt_qutaid= " + qutaid + @")
                        ,quta_foreignamount =  (select sum(qtdt_foreignamount) from QuotationDetail where qtdt_deleted is null and qtdt_qutaid= " + qutaid + @")    where quta_Quotationid=" + qutaid;
                        qs.ExecuteNonQuery();
                        Dispatch.Redirect(UrlDotNet(ThisDotNetDll, "RunQDAdd") + "&quta_Quotationid=" + qutaid);
                    }
                }
                if (errflag != -1)
                {
                    if (errflag == 1)
                    {
                        AddError(errmsg);
                    }
                    List UseList = new List("QuotationDetailGrid");
                    UseList.Filter        = "qtdt_deleted is null and qtdt_qutaid =" + qutaid;
                    UseList.PadBottom     = false;
                    UseList.RowsPerScreen = 50;

                    AddContent(HTML.InputHidden("HiddenMode", ""));
                    QDEntry.GetHtmlInEditMode();
                    VerticalPanel vp = new VerticalPanel();
                    vp.AddAttribute("width", "100%");
                    vp.Add(QDEntry);
                    vp.Add(UseList);
                    AddContent(vp);

                    string url = "javascript:document.EntryForm.HiddenMode.value='Save';";
                    AddSubmitButton("Save", "Save.gif", url);
                    AddUrlButton("Cancel", "cancel.gif", UrlDotNet(ThisDotNetDll, "RunDataPage") + "&quta_Quotationid=" + qutaid);
                }
            }
            catch (Exception ex)
            {
                AddError(ex.Message + "USAddPage");
            }
        }
コード例 #14
0
        public override void BuildContents()
        {
            AddContent(HTML.Form());

            try {
                string     hMode = Dispatch.EitherField("HiddenMode");
                string     optr_opportunityid = Dispatch.EitherField("Key7");
                int        errorflag          = 0;
                string     errormessage       = string.Empty;
                EntryGroup OppoTrackNewEntry  = new EntryGroup("OppoTrackNewEntry");
                //CostAdjustmentProductNewEntry.Title = "Add CostAdjustmentProduct";
                Entry optr_opportunityidEntry = OppoTrackNewEntry.GetEntry("optr_opportunityid");
                if (optr_opportunityidEntry != null)
                {
                    optr_opportunityidEntry.DefaultValue = optr_opportunityid;
                    optr_opportunityidEntry.ReadOnly     = true;
                }

                AddTabHead("OppoTrack");
                if (hMode == "Save")
                {
                    Record OppoTrack = new Record("OppoTrack");
                    OppoTrackNewEntry.Fill(OppoTrack);
                    if (OppoTrackNewEntry.Validate())
                    {
                        OppoTrack.SaveChanges();
                        QuerySelect qs = this.GetQuery();
                        qs.SQLCommand = @"Update Opportunity set oppo_nexttrackdate = (select MAX(optr_nexttrackdate) from OppoTrack where optr_deleted is null and optr_opportunityid=" + optr_opportunityid + @")
                        ,oppo_trackdate = (select MAX(optr_date) from OppoTrack where optr_deleted is null and optr_opportunityid=" + optr_opportunityid + @" ) where oppo_opportunityid=" + optr_opportunityid;
                        qs.ExecuteNonQuery();

                        string url = UrlDotNet(ThisDotNetDll, "RunDataPage") + "&optr_oppotrackid=" + OppoTrack.GetFieldAsString("optr_oppotrackid") + "&J=Summary";
                        Dispatch.Redirect(url);
                        errorflag = -1;
                    }
                    else
                    {
                        errorflag = 1;
                    }
                }
                if (errorflag != -1)
                {
                    if (errorflag == 2)
                    {
                        AddError(errormessage);
                    }

                    AddContent(HTML.InputHidden("HiddenMode", ""));
                    VerticalPanel vpMainPanel = new VerticalPanel();
                    vpMainPanel.AddAttribute("width", "100%");
                    string sUrl = "javascript:document.EntryForm.HiddenMode.value='Save';";
                    OppoTrackNewEntry.GetHtmlInEditMode();
                    vpMainPanel.Add(OppoTrackNewEntry);
                    AddContent(vpMainPanel);
                    AddSubmitButton("Save", "Save.gif", sUrl);
                    AddUrlButton("Cancel", "cancel.gif", UrlDotNet(ThisDotNetDll, "RunListPage") + "&J=OppoTrack&T=Opportunity");
                }
            } catch (Exception e) {
                AddError(e.Message);
            }
        }